Drupal allows third-party modules to create their own hooks. In general practice, there are two types of hooks you may want to create, one is the content modification class hook, the other is the interception class hook. Drupal's hook system allows interaction with modules and changes the logic of other modules.... Drupal allows third-party modules to create their own hooks. In general practice, there are two types of hooks you may want to create, one is the content modification class hook, the other is the interception class hook.
Drupal's hook system allows interaction with modules and changes the logic of other modules, or even changes the core logic of Drupal. This is a very simple system, and even allows third-party modules to create their own hooks. In general practice, there are two types of hooks you may want to create, one is the content modification class hook, the other is the interception class hook. The hook of the modify class provides a standard method to modify the content of a specific object or variable. Typically, the drupal_alter () function is used. The interception hook allows a third-party module to perform certain actions according to the conditions during Module execution.
Example 1: Simple call
Example 2: aggregation result
Example 3: Use drupal_alter () to change the content
'value1','key2' => 'value2',);// will call all modules implementing hook_my_data_alterdrupal_alter('my_data', $data);?>
Example 4: reference parameter passing. module_invoke cannot be used.
Tutorial address:
Reprinted! But please include the article address ^