Hooks

Allow modules to interact with the Drupal core.

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().

Funkcje

NazwaLokalizacjaOpis
custom_url_rewrite_inboundmodules/system/system.api.phpcustom_url_rewrite_inbound is not a hook, it's a function you can add to settings.php to alter incoming requests so they map to a Drupal path. This function is called before modules are loaded and the menu system is initialized and it changes...
custom_url_rewrite_outboundmodules/system/system.api.phpcustom_url_rewrite_outbound is not a hook, it's a function you can add to settings.php to alter all links generated by Drupal. This function is called from url(). This function is called very frequently (100+ times per page) so performance...
hook_accessmodules/node/node.api.phpDefiniuje ograniczenia dostępu.
hook_actions_deletemodules/trigger/trigger.api.phpWykonuje kod po wykasowaniu wpisu.
hook_action_infomodules/trigger/trigger.api.phpDeklaruje informacje na temat jednej lub więcej czynności zautomatyzowanych.
hook_action_info_altermodules/trigger/trigger.api.phpModyfikuje czynności zautomatyzowane zdeklarowane przez inne moduły.
hook_aggregator_fetchmodules/aggregator/aggregator.api.phpImplement this hook to create an alternative fetcher for aggregator module.
hook_aggregator_fetch_infomodules/aggregator/aggregator.api.phpImplement this hook to expose the title and a short description of your fetcher.
hook_aggregator_parsemodules/aggregator/aggregator.api.phpImplement this hook to create an alternative parser for aggregator module.
hook_aggregator_parse_infomodules/aggregator/aggregator.api.phpImplement this hook to expose the title and a short description of your parser.
hook_aggregator_processmodules/aggregator/aggregator.api.phpImplement this hook to create a processor for aggregator module.
hook_aggregator_process_infomodules/aggregator/aggregator.api.phpImplement this hook to expose the title and a short description of your processor.
hook_aggregator_removemodules/aggregator/aggregator.api.phpImplement this hook to remove stored data if a feed is being deleted or a feed's items are being removed.
hook_blockdeveloper-docs/hooks/core.phpDeklaruje blok lub zestaw bloków.
hook_block_configuremodules/block/block.api.phpConfiguration form for the block.
hook_block_listmodules/block/block.api.phpWyświetla listę wszystkich bloków zdefiniowanych przez moduł.
hook_block_savemodules/block/block.api.phpZapisuje opcje konfiguracji.
hook_block_viewmodules/block/block.api.phpProcess the block when enabled in a region in order to view its contents.
hook_bootmodules/system/system.api.phpPerform setup tasks. See also, hook_init.
hook_commentdeveloper-docs/hooks/core.phpDziałania na komentarzach.
hook_comment_deletemodules/comment/comment.api.phpThe comment is being deleted by the moderator.
hook_comment_insertmodules/comment/comment.api.phpThe comment is being inserted.
hook_comment_publishmodules/comment/comment.api.phpThe comment is being published by the moderator.
hook_comment_unpublishmodules/comment/comment.api.phpThe comment is being unpublished by the moderator.
hook_comment_updatemodules/comment/comment.api.phpThe comment is being updated.
hook_comment_validatemodules/comment/comment.api.phpThe user has just finished editing the comment and is trying to preview or submit it. This hook can be used to check or even modify the comment. Errors should be set with form_set_error().
hook_comment_viewmodules/comment/comment.api.phpThe comment is being viewed. This hook can be used to add additional data to the comment before theming.
hook_cronmodules/system/system.api.phpWykonuje okresowe czynności.
hook_db_rewrite_sqlmodules/system/system.api.phpPrzepisuje zapytania do bazy, zazwyczaj w celu kontroli dostępu.
hook_deletemodules/node/node.api.phpWykonuje jakieś czynności przy usuwaniu wpisu.
hook_disablemodules/system/system.api.phpPerform necessary actions before module is disabled.
hook_elementsmodules/system/system.api.phpAllows modules to declare their own Forms API element types and specify their default values.
hook_enablemodules/system/system.api.phpPerform necessary actions after module is enabled.
hook_exitmodules/system/system.api.phpPerform cleanup tasks.
hook_file_copymodules/system/system.api.phpRespond to a file that has been copied.
hook_file_deletemodules/system/system.api.phpRespond to a file being deleted.
hook_file_downloadmodules/system/system.api.phpControl access to private file downloads and specify HTTP headers.
hook_file_insertmodules/system/system.api.phpRespond to a file being added.
hook_file_loadmodules/system/system.api.phpLoad additional information into file objects.
hook_file_movemodules/system/system.api.phpRespond to a file that has been moved.
hook_file_referencesmodules/system/system.api.phpReport the number of times a file is referenced by a module.
hook_file_updatemodules/system/system.api.phpRespond to a file being updated.
hook_file_validatemodules/system/system.api.phpCheck that files meet a given criteria.
hook_filtermodules/filter/filter.api.phpDefiniuje filtry treści.
hook_filter_tipsmodules/filter/filter.api.phpZapewnia wskazówki przy korzystaniu z filtrów.
hook_flush_cachesmodules/system/system.api.phpAdd a list of cache tables to be cleared.
hook_footermodules/system/system.api.phpWstawia zamykający kod HTML.
hook_formmodules/node/node.api.phpDisplay a node editing form.
hook_formsmodules/system/system.api.phpMap form_ids to builder functions.
hook_form_altermodules/system/system.api.phpPerform alterations before a form is rendered.
hook_form_FORM_ID_altermodules/system/system.api.phpProvide a form-specific alteration instead of the global hook_form_alter().
hook_helpmodules/help/help.api.phpZapewnia pomoc użytkownikom.
hook_hook_infomodules/trigger/trigger.api.phpExpose a list of triggers (events) that your module is allowing users to assign actions to.
hook_image_toolkitsmodules/system/system.api.phpDefine image toolkits provided by this module.
hook_initmodules/system/system.api.phpPerform setup tasks. See also, hook_boot.
hook_insertmodules/node/node.api.phpOdpowiada na wstawienie do bazy wpisu.
hook_installmodules/system/system.api.phpInstall the current version of the database schema, and any other setup tasks.
hook_js_altermodules/system/system.api.phpPerform necessary alterations to the JavaScript before it is presented on the page.
hook_linkmodules/system/system.api.phpDefiniuje wewnętrzne łącza Drupala.
hook_link_altermodules/system/system.api.phpPerform alterations before links on a comment are rendered. One popular use of this hook is to modify/remove links from other modules. If you want to add a link to the links section of a node, use hook_link instead.
hook_loadmodules/node/node.api.phpLoad node-type-specific information.
hook_localemodules/locale/locale.api.phpAllows modules to define their own text groups that can be translated.
hook_mailmodules/system/system.api.phpPrepare a message based on parameters. @see drupal_mail for more.
hook_mail_altermodules/system/system.api.phpAlter any aspect of the emails sent by Drupal. You can use this hook to add a common site footer to all outgoing emails; add extra header fields and/or modify the mails sent out in any way. HTML-izing the outgoing mails is one possibility. See also...
hook_menumodules/menu/menu.api.phpDefine menu items and page callbacks.
hook_menu_altermodules/menu/menu.api.phpAlter the data being saved to the {menu_router} table after hook_menu is invoked.
hook_menu_link_altermodules/menu/menu.api.phpAlter the data being saved to the {menu_links} table by menu_link_save().
hook_modules_disabledmodules/system/system.api.phpPerform necessary actions after modules are disabled.
hook_modules_enabledmodules/system/system.api.phpPerform necessary actions after modules are enabled.
hook_modules_installedmodules/system/system.api.phpPerform necessary actions after modules are installed.
hook_modules_uninstalledmodules/system/system.api.phpPerform necessary actions after modules are uninstalled.
hook_nodeapideveloper-docs/hooks/core.phpAct on nodes defined by other modules.
hook_node_access_recordsmodules/node/node.api.phpSet permissions for a node to be written to the database.
hook_node_build_altermodules/node/node.api.phpThe node content was built, the module may modify the structured content.
hook_node_deletemodules/node/node.api.phpAct on node deletion.
hook_node_delete_revisionmodules/node/node.api.phpA revision of the node is deleted.
hook_node_grantsmodules/node/node.api.phpInform the node access system what permissions the user has.
hook_node_infomodules/node/node.api.phpDefine module-provided node types.
hook_node_insertmodules/node/node.api.phpOdpowiada na wstawienie do bazy wpisu.
hook_node_loadmodules/node/node.api.phpAct on node objects when loaded.
hook_node_operationsmodules/node/node.api.phpAdd mass node operations.
hook_node_preparemodules/node/node.api.phpThe node is about to be shown on the add/edit form.
hook_node_prepare_translationmodules/node/node.api.phpThe node is being cloned for translation.
hook_node_presavemodules/node/node.api.phpThe node passed validation and is about to be saved.
hook_node_search_resultmodules/node/node.api.phpThe node is being displayed as a search result.
hook_node_typemodules/node/node.api.phpAct on node type changes.
hook_node_updatemodules/node/node.api.phpThe node being updated.
hook_node_update_indexmodules/node/node.api.phpThe node is being indexed.
hook_node_validatemodules/node/node.api.phpThe user has finished editing the node and is previewing or submitting it.
hook_node_viewmodules/node/node.api.phpThe node content is being assembled before rendering.
hook_openidmodules/openid/openid.api.phpAllow modules to modify the OpenID request parameters.
hook_page_altermodules/system/system.api.phpPerform alterations before a page is rendered.
hook_permmodules/system/system.api.phpDefine user permissions.
hook_pingdeveloper-docs/hooks/core.phpPing another server.
hook_preparemodules/node/node.api.phpThis is a hook used by node modules. It is called after load but before the node is shown on the add/edit form.
hook_profile_altermodules/system/system.api.phpPerform alterations profile items before they are rendered. You may omit/add/re-sort/re-categorize, etc.
hook_query_altermodules/system/system.api.phpPerform alterations to a structured query.
hook_query_TAG_altermodules/system/system.api.phpPerform alterations to a structured query for a given tag.
hook_requirementsmodules/system/system.api.phpCheck installation requirements and do status reporting.
hook_schemamodules/system/system.api.phpDefine the current version of the database schema.
hook_schema_altermodules/system/system.api.phpPerform alterations to existing database schemas.
hook_searchmodules/search/search.api.phpDefine a custom search routine.
hook_search_preprocessmodules/search/search.api.phpPreprocess text for the search index.
hook_system_info_altermodules/system/system.api.phpAlter the information parsed from module and theme .info files
hook_taxonomydeveloper-docs/hooks/core.phpAct on taxonomy changes.
hook_taxonomy_term_deletemodules/taxonomy/taxonomy.api.phpRespond to the deletion of taxonomy terms.
hook_taxonomy_term_insertmodules/taxonomy/taxonomy.api.phpAct on taxonomy terms when inserted.
hook_taxonomy_term_loadmodules/taxonomy/taxonomy.api.phpAct on taxonomy terms when loaded.
hook_taxonomy_term_updatemodules/taxonomy/taxonomy.api.phpAct on taxonomy terms when updated.
hook_taxonomy_vocabulary_deletemodules/taxonomy/taxonomy.api.phpRespond to the deletion of taxonomy vocabularies.
hook_taxonomy_vocabulary_insertmodules/taxonomy/taxonomy.api.phpAct on taxonomy vocabularies when inserted.
hook_taxonomy_vocabulary_loadmodules/taxonomy/taxonomy.api.phpAct on taxonomy vocabularies when loaded.
hook_taxonomy_vocabulary_updatemodules/taxonomy/taxonomy.api.phpAct on taxonomy vocabularies when updated.
hook_term_pathdeveloper-docs/hooks/core.phpAllows modules to provide an alternative path for the terms it manages.
hook_test_finishedmodules/simpletest/simpletest.api.phpAn individual test has finished.
hook_test_group_finishedmodules/simpletest/simpletest.api.phpA test group has finished.
hook_test_group_startedmodules/simpletest/simpletest.api.phpA test group has started.
hook_thememodules/system/system.api.phpRegister a module (or theme's) theme implementations.
hook_theme_registry_altermodules/system/system.api.phpAlter the theme registry information returned from hook_theme().
hook_translated_menu_link_altermodules/menu/menu.api.phpAlter a menu link after it's translated, but before it's rendered.
hook_translation_link_altermodules/locale/locale.api.phpPerform alterations on translation links.
hook_uninstallmodules/system/system.api.phpRemove any information that the module sets.
hook_updatemodules/node/node.api.phpWykonaj czynności przy aktualizowaniu wpisu.
hook_update_indexmodules/search/search.api.phpUpdate Drupal's full-text index for this module.
hook_update_last_removedmodules/system/system.api.phpReturn a number which is no longer available as hook_update_N().
hook_update_Nmodules/system/system.api.phpPerform a single update. For each patch which requires a database change add a new hook_update_N() which will be called by update.php.
hook_update_status_altermodules/update/update.api.phpAlter the information about available updates for projects.
hook_usermodules/user/user.api.phpAct on user account actions.
hook_user_cancelmodules/user/user.api.phpAct on user account cancellations.
hook_user_cancel_methods_altermodules/user/user.api.phpModify account cancellation methods.
hook_user_loadmodules/user/user.api.phpAct on user objects when loaded from the database.
hook_user_operationsmodules/user/user.api.phpAdd mass user operations.
hook_validatemodules/node/node.api.phpZweryfikuj dane w formularzu.
hook_viewmodules/node/node.api.phpDokonaj zmiany w wpisie, zanim zostanie wyświetlony.
hook_watchdogmodules/system/system.api.phpLog an event message
hook_xmlrpcmodules/system/system.api.phpRegister XML-RPC callbacks.
module_hookincludes/module.incDetermine whether a module implements a hook.
module_implementsincludes/module.incDetermine which modules are implementing a hook.
module_invokeincludes/module.incInvoke a hook in a particular module.
module_invoke_allincludes/module.incInvoke a hook in all enabled modules that implement it.
_module_implements_maintenanceincludes/module.incThis is the maintenance version of module_implements for internal use only.

Dodaj nową odpowiedź

  • Adresy internetowe są automatycznie zamieniane w odnośniki, które można kliknąć.
  • Dozwolone znaczniki HTML: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Znaki końca linii i akapitu dodawane są automatycznie.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

Więcej informacji na temat formatowania

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.