Drupal 7 update entity
Here is another way to do it. I highly recommend using revisions when updating stuff programmatically. Note that this function takes a node object as its argument, so do something like this:. If you use pathauto, it will overwrite custom aliases unless you explicitly disable it with the following:.
Revised See also Guide to programmatic node creation in Drupal 7. Update While the method described further down still works, a much better way of updating nodes is to use the entity metadata wrappers provided by the entity module. Create a free Team What is Teams? Learn more. How do I make a custom entity update or create automatically update the solr index?
Ask Question. Asked 8 years, 6 months ago. Active 8 years ago. Viewed 3k times. Improve this question. Add a comment. Active Oldest Votes. Improve this answer. Then, I'd like to make this entity available for apache solr indexing. Hi cyrilT you do need to implement both hooks. The Apache Solr User module is a great module to look through to help you understand how to implement your own custom entities as this does the same thing for the user entity.
Hope that helps! Apache solr has is own database table for entity information. Correct me if I wrong. Thanks I hope that could help some other folks as myself after hours surfing on forums and banging my head against the wall. Create a free Team What is Teams? Learn more. Does Drupal 8 entities have any events I can listen to? Ask Question. Asked 5 years, 1 month ago.
Active 1 month ago. Viewed 9k times. Improve this question. John John 91 1 1 silver badge 2 2 bronze badges. Add a comment. Active Oldest Votes. Here is the order of hooks and other events that happen during an entity save: Entity::preSave is called on entity objects, and FieldItemListInterface::preSave on field objects. Entity::postSave is called on the entity object. Improve this answer. So entities won't dispatch any events that I can subscribe to?
0コメント