Drupal: Are hook_ functions in * .api.php ever called?

In Drupal 7, each core module has a *.api.php file, where * is the name of the module. for example

 modules/node/node.api.php modules/path/path.api.php 

What are these files for? They contain functions starting with hook_ , and the name of the hook that (I think) calls the module. for example

 modules/system/system.api 

It has

 function hook_entity_view($entity, $type, $view_mode, $langcode) { $entity->content['my_additional_field'] = array( '#markup' => $additional_field, '#weight' => 10, '#theme' => 'mymodule_my_additional_field', ); } 

There is an entity_view hook entity_view , which is called by a system that you can implement in your own modules, but (it does not appear) that hook_entity_view ever called.

What are these functions for? Are they ever called a system? If yes, then when? If not, why are they there?

+7
source share
1 answer

No, these are just documentation files describing module hooks. About hook_entity_view: you can add it to the user module: YOURMODULENAME_entity_view (...).

+14
source

All Articles