简体   繁体   中英

Drupal 8 hook_node_load not working

I am facing the following challenge for porting my module "Country Specific Nodes" to D8.
I need to finding the right replacement of Drupal 7's hook_node_load in Drupal 8. I tried hook_entity_load as well as hook_ENTITY_TYPE_load , but it returns the Entity objects and not the actual node objects as in D7's hook_node_load .
Please let me know the right approach to this. Thanks for reading out and helping.

Thanks.

I found the solution for this. Use >hook_ENTITY_TYPE_load($entities) for loading nodes. Actually this hook is not called every time a page loads. This is called only when the node is accessed or iterated.

Thanks.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM