Functions | |
module_hook ($module, $hook) | |
module_implements ($hook, $sort=FALSE, $refresh=FALSE) | |
module_invoke () | |
module_invoke_all () |
Drupal's module system is based on the concept of "hooks". A hook is a PHP function that is named foo_bar(), where "foo" is the name of the module (whose filename is thus foo.module) and "bar" is the name of the hook. Each hook has a defined set of parameters and a specified result type.
To extend Drupal, a module need simply implement a hook. When Drupal wishes to allow intervention from modules, it determines which modules implement a hook and call that hook in all enabled modules that implement it.
The available hooks to implement are explained here in the Hooks section of the developer documentation. The string "hook" is used as a placeholder for the module name is the hook definitions. For example, if the module file is called example.module, then hook_help() as implemented by that module would be defined as example_help().
module_hook | ( | $ | module, | |
$ | hook | |||
) |
Determine whether a module implements a hook.
$module | The name of the module (without the .module extension). | |
$hook | The name of the hook (e.g. "help" or "menu"). |
Definition at line 379 of file module.inc.
References drupal_function_exists().
Referenced by help_page(), menu_get_active_help(), module_disable(), module_enable(), module_implements(), module_invoke(), module_rebuild_cache(), search_admin_settings(), system_modules(), and system_modules_uninstall().
module_implements | ( | $ | hook, | |
$ | sort = FALSE , |
|||
$ | refresh = FALSE | |||
) |
Determine which modules are implementing a hook.
$hook | The name of the hook (e.g. "help" or "menu"). | |
$sort | By default, modules are ordered by weight and filename, settings this option to TRUE, module list will be ordered by module name. | |
$refresh | For internal use only: Whether to force the stored list of hook implementations to be regenerated (such as after enabling a new module, before processing hook_enable). |
Definition at line 404 of file module.inc.
References module_hook(), module_list(), registry_cache_hook_implementations(), and registry_get_hook_implementations_cache().
Referenced by _db_rewrite_sql(), _element_info(), _theme_build_registry(), drupal_alter(), drupal_get_schema(), help_links_as_list(), menu_router_build(), module_disable(), module_invoke_all(), node_configure(), system_performance_settings(), and watchdog().
module_invoke | ( | ) |
Invoke a hook in a particular module.
$module | The name of the module (without the .module extension). | |
$hook | The name of the hook to invoke. | |
... | Arguments to pass to the hook implementation. |
Definition at line 445 of file module.inc.
References module_hook().
Referenced by _db_rewrite_sql(), _drupal_install_module(), _element_info(), _update_refresh(), block_admin_configure(), block_admin_configure_submit(), bootstrap_invoke_all(), drupal_check_module(), drupal_get_schema(), drupal_get_schema_unprocessed(), drupal_http_request(), drupal_install_system(), drupal_uninstall_module(), filter_admin_configure(), filter_admin_format_form(), filter_admin_format_form_submit(), help_links_as_list(), help_page(), menu_get_active_help(), module_disable(), module_enable(), node_filter_form(), node_filters(), path_admin_overview(), search_admin_settings(), search_view(), system_admin_by_module(), system_modules(), system_modules_submit(), system_themes_form_submit(), update_check_requirements(), update_script_selection_form(), user_admin_perm(), watchdog(), and xmlrpc_error().
module_invoke_all | ( | ) |
Invoke a hook in all enabled modules that implement it.
$hook | The name of the hook to invoke. | |
... | Arguments to pass to the hook. |
Definition at line 465 of file module.inc.
References $result, $return, drupal_function_exists(), and module_implements().
Referenced by _drupal_bootstrap_full(), _locale_translate_seek(), actions_delete(), actions_list(), drupal_cron_run(), drupal_flush_all_caches(), drupal_goto(), drupal_page_footer(), drupal_retrieve_form(), file_download(), locale_translate_export_po_form(), locale_translate_export_pot_form(), locale_translate_import_form(), locale_translate_overview_screen(), locale_translate_seek_form(), node_admin_nodes(), node_admin_nodes_submit(), node_type_reset(), search_admin_settings(), system_status(), theme_closure(), trigger_assign(), user_admin_account(), user_admin_account_submit(), and user_logout().