Drupal HOOK徹底解説

Drupal HOOK徹底解説
Drupal HOOK徹底解説

Drupal におけるフック( hooks )とは、「 Drupal のモジュールが他のモジュールや Drupal のコアとの間でやりとりをするための仕組み」のことです。

DRUPALとは

Drupalとは、2001年に誕生した、PHP製のオープンソースのコンテンツ管理システム(CMS)です。世界中で100万以上のサイトで稼働していると言われており、海外だとNASAやオーストラリア政府、また、NASDAQなどの金融機関、ネスレ、ジョンソン・エンド・ジョンソンなどのグローバル企業がDrupalを採用しています。

HOOKとは

Drupal におけるフック( hooks )とは、「 Drupal のモジュールが他のモジュールや Drupal のコアとの間でやりとりをするための仕組み」のことです。

具体的には、指定されたパターンの名前の関数を書けばそれが「フック関数」として認識され所定の場所で呼び出されるという仕組みになっています。

How to invoke a new hook in a Drupal module (and add yourself to a round of beer)

https://befused.com/drupal/invoke-hook/

By Blair Wadman

So, you want to allow other modules to hook into your own module. You may have implemented hooks that other modules provide, but does invoking your own hook for a module seem like a dark art? It is as simple as calling one function in your module. All will be revealed shortly, but first, lets look at why you would want to invoke your own hook.

What is invoking a hook?

When you invoke a hook, you are registering a new hook with Drupal that allows other modules to implement and therefore interact with your module. You are providing hook in points in your module which say to other modules “here is a point where you can inject your own data or extend my module”.

Why invoke hooks?

The hook system is at the heart of what makes Drupal powerful. All modules will use hooks to interact with the rest of the Drupal system. By invoking your own hook, you are making your module more powerful and useful because you are allowing other modules to extend it or change its data in some way. If no module invoked hooks, there would be no hooks for you to implement! If it still does not make sense, don’t worry, as the best way to understand it is with an example.

Beer round example

Let’s take a really simple example. Imagine you have a module with some code which returns a list of people included in a round of beer. And then you want to invoke your own hook so that other modules can add to the list of names that are part of the beer round.

Let’s set the module up before invoking the hook. The module is called beer_round. In beer_round.module you firstly need to implement hook_menu() to define the path where we can see the list of names for the beer round.

/**
 * Implements hook_menu.
 */
function beer_round_menu() {
  $items = array();

  $items['beer'] = array(
    'title' => 'Beer round',
    'page callback' => 'beer_round_callback',
    'access arguments' => array('access content'),
    'type' => MENU_CALLBACK,
  );

  return $items;
}

This snippet simply means, when the user goes to the path beer, call the callback function called beer_round_callback(). Anyone who has the access content permission has the necessary permissions to view this page.

Next you need to define the callback function.

/**
 * List of people included in a round of beer.
 */
function beer_round_callback() {
  $round = array('Dave', 'Paolo', 'Andrew', 'Mat', 'Paula', 'Mihhail', 'Pete', 'Dima', 'Bhavna', 'Laura', 'Steve', 'San', 'Nick');
  $output = theme('item_list', array('items' => $round));

  return $output;
}

This contains an array of names of people who are part of the beer round. You then pass that array into the theme() function, which will convert it into an unordered list. If you now hit the path beer, you will see the list of names.

Blair added to the beer round after implementing hook_beer_round

Now it is time to invoke a new hook. To invoke a new hook, all you need to do is call module_invoke_all() and pass in the name of the hook. We will call the hook beer_round. So you will call module_invoke_all(‘beer_round’) and add the result to the array of people in the round.

/**
 * List of people included in a round of beer.
 */
function beer_round_callback() {
  $round = array('Dave', 'Paolo', 'Andrew', 'Mat', 'Paula', 'Mihhail', 'Pete', 'Dima', 'Bhavna', 'Laura', 'Steve', 'San', 'Nick');
  $round_more = module_invoke_all('beer_round');
  $round_all = array_merge($round, $round_more);
  $output = theme('item_list', array('items' => $round_all));

  return $output;
}

Drupal will check every module to see if hook_beer_round has been implemented. If it has, the data the modules provide will be added to $round_more, which will be an array. If two modules implement hook_beer_round(), the array will contain two elements. So now we have two arrays, the original array of people in the beer round, and the additional people added via the hook. So merge the two together with array_merge(), and you have the full round.

To see this in action, implement hook_beer_round() in another module. I have a module called ‘blair’ where I will add myself to the beer round.

My implementation of hook_beer_round is:

 /**
 * Implements hook_beer_round();
 */
function blair_beer_round() {
 return 'Blair';
}

Now if you reload the beer page, you will see that my name has been added.

Blair added to the beer round after implementing hook_beer_round

That is all there is to invoking a hook! This is a very simple example to get you started. I will go into a more advanced example in a future post.

Note: real names are used in the example, but nobody was harmed in the production of this tutorial.

Overview of invoking a hook

Overview of invoking a hook

参考

How to invoke a new hook in a Drupal module (and add yourself to a round of beer)
So, you want to allow other modules to hook into your own module. You may have implemented hooks that other modules provide, but does invoking your own hook for...

Drupal HOOK徹底解説  Drupal10 Drupal9 Drupal8 Drupal7

Filter: Drupal8

名前説明場所Version
hook_block_accessControl access to a block instance.core/modules/block/block.api.phpd10,d9,d8
hook_block_alterAllow modules to alter the block plugin definitions.core/modules/block/block.api.phpd10,d9,d8
hook_block_build_alterAlter the result of DrupalCoreBlockBlockBase::build().core/modules/block/block.api.phpd10,d9,d8
hook_block_build_BASE_BLOCK_ID_alterProvide a block plugin specific block_build alteration.core/modules/block/block.api.phpd10,d9,d8
hook_block_view_BASE_BLOCK_ID_alterProvide a block plugin specific block_view alteration.core/modules/block/block.api.phpd10,d9,d8
hook_cache_flushFlush all persistent and static caches.core/core.api.phpd10,d9,d8
hook_ckeditor4to5upgrade_plugin_info_alterModify the list of available CKEditor 4 to 5 Upgrade plugins.core/modules/ckeditor5/ckeditor5.api.phpd10,d9,d8
hook_ckeditor5_plugin_info_alterModify the list of available CKEditor 5 plugins.core/modules/ckeditor5/ckeditor5.api.phpd10,d9,d8
hook_comment_links_alterAlter the links of a comment.core/modules/comment/comment.api.phpd10,d9,d8
hook_config_import_steps_alterAlter the configuration synchronization steps.core/core.api.phpd10,d9,d8
hook_config_schema_info_alterAlter config typed data definitions.core/core.api.phpd10,d9,d8
hook_config_translation_infoIntroduce dynamic translation tabs for translation of configuration.core/modules/config_translation/config_translation.api.phpd10,d9,d8
hook_config_translation_info_alterAlter existing translation tabs for translation of configuration.core/modules/config_translation/config_translation.api.phpd10,d9,d8
hook_contextual_links_alterAlter contextual links before they are rendered.core/lib/Drupal/Core/Menu/menu.api.phpd10,d9,d8
hook_contextual_links_plugins_alterAlter the plugin definition of contextual links.core/lib/Drupal/Core/Menu/menu.api.phpd10,d9,d8
hook_data_type_info_alterAlter available data types for typed data wrappers.core/core.api.phpd10,d9,d8
hook_display_variant_plugin_alterAlter display variant plugin definitions.core/core.api.phpd10,d9,d8
hook_editor_info_alterPerforms alterations on text editor definitions.core/modules/editor/editor.api.phpd10,d9,d8
hook_editor_js_settings_alterModifies JavaScript settings that are added for text editors.core/modules/editor/editor.api.phpd10,d9,d8
hook_editor_xss_filter_alterModifies the text editor XSS filter that will used for the given text format.core/modules/editor/editor.api.phpd10,d9,d8
hook_element_plugin_alterAlter Element plugin definitions.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_entity_accessControl entity operation access.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_base_field_infoProvides custom base field definitions for a content entity type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_base_field_info_alterAlter base field definitions for a content entity type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_build_defaults_alterAlter entity renderable values before cache checking during rendering.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_bundle_createAct on entity_bundle_create().core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_bundle_deleteAct on entity_bundle_delete().core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_bundle_field_infoProvides field definitions for a specific bundle within an entity type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_bundle_field_info_alterAlter bundle field definitions.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_bundle_infoDescribe the bundles for entity types.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_bundle_info_alterAlter the bundles for entity types.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_createActs when creating a new entity.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_create_accessControl entity create access.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_display_build_alterAlter the render array generated by an EntityDisplay for an entity.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_extra_field_infoExposes "pseudo-field" components on content entities.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_extra_field_info_alterAlter "pseudo-field" components on content entities.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_field_accessControl access to fields.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_field_access_alterAlter the default access behavior for a given field.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_field_storage_infoProvides field storage definitions for a content entity type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_field_storage_info_alterAlter field storage definitions for a content entity type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_field_values_initActs when initializing a fieldable entity object.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_form_display_alterAlter the settings used for displaying an entity form.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_form_mode_alterChange the form mode used to build an entity form.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_operationDeclares entity operations.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_operation_alterAlter entity operations.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_predeleteAct before entity deletion.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_preloadAct on an array of entity IDs before they are loaded.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_prepare_formActs on an entity object about to be shown on an entity form.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_revision_createRespond to entity revision creation.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_revision_deleteRespond to entity revision deletion.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_storage_loadAct on content entities when loaded from the storage.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_translation_createActs when creating a new entity translation.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_translation_deleteRespond to entity translation deletion.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_translation_insertRespond to creation of a new entity translation.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_accessControl entity operation access for a specific entity type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_type_alterAlter the entity type definitions.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_type_buildAdd to entity type definitions.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_build_defaults_alterAlter entity renderable values before cache checking during rendering.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_createActs when creating a new entity of a specific type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_create_accessControl entity create access for a specific entity type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_deleteRespond to entity deletion of a particular type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_field_values_initActs when initializing a fieldable entity object.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_insertRespond to creation of a new entity of a particular type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_loadAct on entities of a specific type when loaded.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_predeleteAct before entity deletion of a particular entity type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_prepare_formActs on a particular type of entity object about to be in an entity form.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_presaveAct on a specific type of entity before it is created or updated.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_revision_createRespond to entity revision creation.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_revision_deleteRespond to entity revision deletion of a particular type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_storage_loadAct on content entities of a given type when loaded from the storage.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_translation_createActs when creating a new entity translation of a specific type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_translation_deleteRespond to entity translation deletion of a particular type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_translation_insertRespond to creation of a new entity translation of a particular type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_updateRespond to updates to an entity of a particular type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_viewAct on entities of a particular type being assembled before rendering.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_ENTITY_TYPE_view_alterAlter the results of the entity build array for a particular entity type.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_view_display_alterAlter the settings used for displaying an entity.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_entity_view_mode_info_alterAlter the view modes for entity types.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8
hook_extensionDeclare a template file extension to be used with a theme engine.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_field_purge_field_storageActs when a field storage definition is being purged.core/modules/field/field.api.phpd10,d9,d8
hook_field_storage_config_update_forbidForbid a field storage update from occurring.core/modules/field/field.api.phpd10,d9,d8
hook_field_ui_preconfigured_options_alterPerform alterations on preconfigured field options.core/modules/field/field.api.phpd10,d9,d8
hook_field_views_dataOverride the default Views data for a Field API field.core/modules/views/views.api.phpd10,d9,d8
hook_field_views_data_alterAlter the Views data for a single Field API field.core/modules/views/views.api.phpd10,d9,d8
hook_field_views_data_views_data_alterAlter the Views data on a per field basis.core/modules/views/views.api.phpd10,d9,d8
hook_field_widget_complete_form_alterAlter the complete form for field widgets provided by other modules.core/modules/field/field.api.phpd10,d9,d8
hook_field_widget_complete_WIDGET_TYPE_form_alterAlter the complete form for a specific widget provided by other modules.core/modules/field/field.api.phpd10,d9,d8
hook_field_widget_single_element_form_alterAlter forms for field widgets provided by other modules.core/modules/field/field.api.phpd10,d9,d8
hook_field_widget_single_element_WIDGET_TYPE_form_alterAlter widget forms for a specific widget provided by another module.core/modules/field/field.api.phpd10,d9,d8
hook_filter_secure_image_alterAlters images with an invalid source.core/modules/filter/filter.api.phpd10,d9,d8
hook_form_system_theme_settings_alterAllow themes to alter the theme-specific settings form.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_help_section_info_alterPerform alterations on help page section plugin definitions.core/modules/help/help.api.phpd10,d9,d8
hook_help_topics_info_alterPerform alterations on help topic definitions.core/modules/help_topics/help_topics.api.phpd10,d9,d8
hook_js_settings_alterPerform necessary alterations to the JavaScript settings (drupalSettings).core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_js_settings_buildModify the JavaScript settings (drupalSettings).core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_jsonapi_entity_field_filter_accessRestricts filtering access to the given field.core/modules/jsonapi/jsonapi.api.phpd10,d9,d8
hook_jsonapi_entity_filter_accessControls access when filtering by entity data via JSON:API.core/modules/jsonapi/jsonapi.api.phpd10,d9,d8
hook_jsonapi_ENTITY_TYPE_filter_accessControls access to filtering by entity data via JSON:API.core/modules/jsonapi/jsonapi.api.phpd10,d9,d8
hook_language_fallback_candidates_OPERATION_alterAllow modules to alter the fallback candidates for specific operations.core/modules/language/language.api.phpd10,d9,d8
hook_layout_alterAllow modules to alter layout plugin definitions.core/core.api.phpd10,d9,d8
hook_library_info_alterAlter libraries provided by an extension.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_library_info_buildAdd dynamic library definitions.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_link_alterAlter the parameters for links.core/lib/Drupal/Core/Menu/menu.api.phpd10,d9,d8
hook_local_tasks_alterAlter local tasks plugins.core/lib/Drupal/Core/Menu/menu.api.phpd10,d9,d8
hook_locale_translation_projects_alterAlter the list of projects to be updated by locale's interface translation.core/modules/locale/locale.api.phpd10,d9,d8
hook_mail_backend_info_alterAlter the list of mail backend plugin definitions.core/core.api.phpd10,d9,d8
hook_media_source_info_alterAlters the information provided in DrupalmediaAnnotationMediaSource.core/modules/media/media.api.phpd10,d9,d8
hook_menu_links_discovered_alterAlters all the menu links discovered by the menu link plugin manager.core/lib/Drupal/Core/Menu/menu.api.phpd10,d9,d8
hook_menu_local_actions_alterAlter local actions plugins.core/lib/Drupal/Core/Menu/menu.api.phpd10,d9,d8
hook_migrate_MIGRATION_ID_prepare_rowAllows adding data to a row for a migration with the specified ID.core/modules/migrate/migrate.api.phpd10,d9,d8
hook_migrate_prepare_rowAllows adding data to a row before processing it.core/modules/migrate/migrate.api.phpd10,d9,d8
hook_migration_plugins_alterAllows altering the list of discovered migration plugins.core/modules/migrate/migrate.api.phpd10,d9,d8
hook_module_preinstallPerform necessary actions before a module is installed.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8
hook_module_preuninstallPerform necessary actions before a module is uninstalled.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8
hook_node_links_alterAlter the links of a node.core/modules/node/node.api.phpd10,d9,d8
hook_oembed_resource_url_alterAlters an oEmbed resource URL before it is fetched.core/modules/media/media.api.phpd10,d9,d8
hook_options_list_alterAlters the list of options to be displayed for a field.core/modules/options/options.api.phpd10,d9,d8
hook_page_attachmentsAdd attachments (typically assets) to a page before it is rendered.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_page_attachments_alterAlter attachments (typically assets) to a page before it is rendered.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_page_bottomAdd a renderable array to the bottom of the page.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_page_topAdd a renderable array to the top of the page.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_plugin_filter_TYPE__CONSUMER_alterAlter the filtering of plugin definitions for a specific type and consumer.core/lib/Drupal/Core/Plugin/plugin.api.phpd10,d9,d8
hook_plugin_filter_TYPE_alterAlter the filtering of plugin definitions for a specific plugin type.core/lib/Drupal/Core/Plugin/plugin.api.phpd10,d9,d8
hook_post_update_NAMEExecutes an update which is intended to update data, like entities.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8
hook_preprocessPreprocess theme variables for templates.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_preprocess_HOOKPreprocess theme variables for a specific theme hook.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_queue_info_alterAlter cron queue information before cron runs.core/core.api.phpd10,d9,d8
hook_rebuildRebuild data based upon refreshed caches.core/core.api.phpd10,d9,d8
hook_removed_post_updatesReturn an array of removed hook_post_update_NAME() function names.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8
hook_render_templateRender a template using the theme engine.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_requirements_alterAlters requirements data.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8
hook_rest_resource_alterAlter the resource plugin definitions.core/modules/rest/rest.api.phpd10,d9,d8
hook_search_plugin_alterAlter search plugin definitions.core/modules/search/search.api.phpd10,d9,d8
hook_system_breadcrumb_alterPerform alterations to the breadcrumb built by the BreadcrumbManager.core/lib/Drupal/Core/Menu/menu.api.phpd10,d9,d8
hook_template_preprocess_default_variables_alterAlter the default, hook-independent variables for all templates.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_theme_suggestions_alterAlters named suggestions for all theme hooks.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_theme_suggestions_HOOKProvides alternate named suggestions for a specific theme hook.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_theme_suggestions_HOOK_alterAlters named suggestions for a specific theme hook.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_themes_installedRespond to themes being installed.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_themes_uninstalledRespond to themes being uninstalled.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8
hook_toolbarAdd items to the toolbar menu.core/modules/toolbar/toolbar.api.phpd10,d9,d8
hook_toolbar_alterAlter the toolbar menu after hook_toolbar() is invoked.core/modules/toolbar/toolbar.api.phpd10,d9,d8
hook_tour_tips_alterAllow modules to alter tour items before render.core/modules/tour/tour.api.phpd10,d9,d8
hook_tour_tips_info_alterAllow modules to alter tip plugin definitions.core/modules/tour/tour.api.phpd10,d9,d8
hook_transliteration_overrides_alterProvide language-specific overrides for transliteration.core/lib/Drupal/Core/Language/language.api.phpd10,d9,d8
hook_user_format_name_alterAlter the username that is displayed for a user.core/modules/user/user.api.phpd10,d9,d8
hook_validation_constraint_alterAlter validation constraint plugin definitions.core/core.api.phpd10,d9,d8
hook_views_analyzeAnalyze a view to provide warnings about its configuration.core/modules/views/views.api.phpd10,d9,d8
hook_views_dataDescribe data tables and fields (or the equivalent) to Views.core/modules/views/views.api.phpd10,d9,d8
hook_views_data_alterAlter the table and field information from hook_views_data().core/modules/views/views.api.phpd10,d9,d8
hook_views_form_substitutionsReplace special strings when processing a view with form elements.core/modules/views/views.api.phpd10,d9,d8
hook_views_invalidate_cacheAllow modules to respond to the invalidation of the Views cache.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_access_alterModify the list of available views access plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_area_alterModify the list of available views area handler plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_argument_alterModify the list of available views argument handler plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_argument_default_alterModify the list of available views default argument plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_argument_validator_alterModify the list of available views argument validation plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_cache_alterModify the list of available views cache plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_display_alterModify the list of available views display plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_display_extenders_alterModify the list of available views display extender plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_exposed_form_alterModify the list of available views exposed form plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_field_alterModify the list of available views field handler plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_filter_alterModify the list of available views filter handler plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_join_alterModify the list of available views join plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_pager_alterModify the list of available views pager plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_query_alterModify the list of available views query plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_relationship_alterModify the list of available views relationship handler plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_row_alterModify the list of available views row plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_sort_alterModify the list of available views sort handler plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_style_alterModify the list of available views style plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_plugins_wizard_alterModify the list of available views wizard plugins.core/modules/views/views.api.phpd10,d9,d8
hook_views_post_buildAct on the view immediately after the query is built.core/modules/views/views.api.phpd10,d9,d8
hook_views_post_executeAct on the view immediately after the query has been executed.core/modules/views/views.api.phpd10,d9,d8
hook_views_post_renderPost-process any render data.core/modules/views/views.api.phpd10,d9,d8
hook_views_pre_buildAct on the view before the query is built, but after displays are attached.core/modules/views/views.api.phpd10,d9,d8
hook_views_pre_executeAct on the view after the query is built and just before it is executed.core/modules/views/views.api.phpd10,d9,d8
hook_views_pre_renderAct on the view immediately before rendering it.core/modules/views/views.api.phpd10,d9,d8
hook_views_pre_viewAlter a view at the very beginning of Views processing.core/modules/views/views.api.phpd10,d9,d8
hook_views_preview_info_alterAlter the view preview information.core/modules/views/views.api.phpd10,d9,d8
hook_views_query_alterAlter the query before it is executed.core/modules/views/views.api.phpd10,d9,d8
hook_views_query_substitutionsReplace special strings in the query before it is executed.core/modules/views/views.api.phpd10,d9,d8
hook_views_ui_display_tab_alterAlter the renderable array representing the edit page for one display.core/modules/views_ui/views_ui.api.phpd10,d9,d8
hook_views_ui_display_top_alterAlter the top of the display for the Views UI.core/modules/views_ui/views_ui.api.phpd10,d9,d8
hook_views_ui_display_top_links_alterAlter the links displayed at the top of the view edit form.core/modules/views_ui/views_ui.api.phpd10,d9,d8
hook_ajax_render_alterAlter the Ajax command data that is sent to the client.core/lib/Drupal/Core/Form/form.api.phpd10,d9,d8,d7
hook_archiver_info_alterAlter archiver information declared by other modules.core/lib/Drupal/Core/File/file.api.phpd10,d9,d8,d7
hook_batch_alterAlter batch information before a batch is processed.core/lib/Drupal/Core/Form/form.api.phpd10,d9,d8,d7
hook_block_view_alterAlter the result of DrupalCoreBlockBlockBase::build().core/modules/block/block.api.phpd10,d9,d8,d7
hook_contextual_links_view_alterAlter a contextual links element before it is rendered.core/modules/contextual/contextual.api.phpd10,d9,d8,d7
hook_countries_alterAlter the default country list.core/core.api.phpd10,d9,d8,d7
hook_cronPerform periodic actions.core/core.api.phpd10,d9,d8,d7
hook_css_alterAlter CSS files before they are output on the page.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8,d7
hook_element_info_alterAlter the element type information returned from modules.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8,d7
hook_entity_deleteRespond to entity deletion.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8,d7
hook_entity_insertRespond to creation of a new entity.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8,d7
hook_entity_loadAct on entities when loaded.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8,d7
hook_entity_prepare_viewAct on entities as they are being prepared for view.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8,d7
hook_entity_presaveAct on an entity before it is created or updated.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8,d7
hook_entity_updateRespond to updates to an entity.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8,d7
hook_entity_viewAct on entities being assembled before rendering.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8,d7
hook_entity_view_alterAlter the results of the entity build array.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8,d7
hook_entity_view_mode_alterChange the view mode of an entity that is being displayed.core/lib/Drupal/Core/Entity/entity.api.phpd10,d9,d8,d7
hook_field_formatter_info_alterPerform alterations on Field API formatter types.core/modules/field/field.api.phpd10,d9,d8,d7
hook_field_info_alterPerform alterations on Field API field types.core/modules/field/field.api.phpd10,d9,d8,d7
hook_field_info_max_weightReturns the maximum weight for the entity components handled by the module.core/modules/field/field.api.phpd10,d9,d8,d7
hook_field_purge_fieldActs when a field is being purged.core/modules/field/field.api.phpd10,d9,d8,d7
hook_field_widget_info_alterPerform alterations on Field API widget types.core/modules/field/field.api.phpd10,d9,d8,d7
hook_file_copyRespond to a file that has been copied.core/modules/file/file.api.phpd10,d9,d8,d7
hook_file_downloadControl access to private file downloads and specify HTTP headers.core/lib/Drupal/Core/File/file.api.phpd10,d9,d8,d7
hook_file_mimetype_mapping_alterAlter MIME type mappings used to determine MIME type from a file extension.core/lib/Drupal/Core/File/file.api.phpd10,d9,d8,d7
hook_file_moveRespond to a file that has been moved.core/modules/file/file.api.phpd10,d9,d8,d7
hook_file_url_alterAlter the URL to a file.core/lib/Drupal/Core/File/file.api.phpd10,d9,d8,d7
hook_file_validateCheck that files meet a given criteria.core/modules/file/file.api.phpd10,d9,d8,d7
hook_filetransfer_infoRegister information about FileTransfer classes provided by a module.core/lib/Drupal/Core/File/file.api.phpd10,d9,d8,d7
hook_filetransfer_info_alterAlter the FileTransfer class registry.core/lib/Drupal/Core/File/file.api.phpd10,d9,d8,d7
hook_filter_format_disablePerform actions when a text format has been disabled.core/modules/filter/filter.api.phpd10,d9,d8,d7
hook_filter_info_alterPerform alterations on filter definitions.core/modules/filter/filter.api.phpd10,d9,d8,d7
hook_form_alterPerform alterations before a form is rendered.core/lib/Drupal/Core/Form/form.api.phpd10,d9,d8,d7
hook_form_BASE_FORM_ID_alterProvide a form-specific alteration for shared ('base') forms.core/lib/Drupal/Core/Form/form.api.phpd10,d9,d8,d7
hook_form_FORM_ID_alterProvide a form-specific alteration instead of the global hook_form_alter().core/lib/Drupal/Core/Form/form.api.phpd10,d9,d8,d7
hook_helpProvide online user help.core/modules/help/help.api.phpd10,d9,d8,d7
hook_hook_infoDefines one or more hooks that are exposed by a module.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_image_effect_info_alterAlter the information provided in DrupalimageAnnotationImageEffect.core/modules/image/image.api.phpd10,d9,d8,d7
hook_image_style_flushRespond to image style flushing.core/modules/image/image.api.phpd10,d9,d8,d7
hook_installPerform setup tasks when the module is installed.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_install_tasksReturn an array of tasks to be performed by an installation profile.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_install_tasks_alterAlter the full list of installation tasks.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_js_alterPerform necessary alterations to the JavaScript before it is presented on the page.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8,d7
hook_language_fallback_candidates_alterAllow modules to alter the language fallback candidates.core/modules/language/language.api.phpd10,d9,d8,d7
hook_language_negotiation_info_alterPerform alterations on language negotiation methods.core/modules/language/language.api.phpd10,d9,d8,d7
hook_language_switch_links_alterPerform alterations on language switcher links.core/lib/Drupal/Core/Language/language.api.phpd10,d9,d8,d7
hook_language_types_infoDefine language types.core/modules/language/language.api.phpd10,d9,d8,d7
hook_language_types_info_alterPerform alterations on language types.core/modules/language/language.api.phpd10,d9,d8,d7
hook_mailPrepares a message based on parameters.core/core.api.phpd10,d9,d8,d7
hook_mail_alterAlter an email message created with MailManagerInterface->mail().core/core.api.phpd10,d9,d8,d7
hook_menu_local_tasks_alterAlter local tasks displayed on the page before they are rendered.core/lib/Drupal/Core/Menu/menu.api.phpd10,d9,d8,d7
hook_module_implements_alterAlter the registry of modules implementing a hook.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_modules_installedPerform necessary actions after modules are installed.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_modules_uninstalledPerform necessary actions after modules are uninstalled.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_node_access_recordsSet permissions for a node to be written to the database.core/modules/node/node.api.phpd10,d9,d8,d7
hook_node_access_records_alterAlter permissions for a node before it is written to the database.core/modules/node/node.api.phpd10,d9,d8,d7
hook_node_grantsInform the node access system what permissions the user has.core/modules/node/node.api.phpd10,d9,d8,d7
hook_node_grants_alterAlter user access rules when trying to view, edit or delete a node.core/modules/node/node.api.phpd10,d9,d8,d7
hook_node_search_resultAct on a node being displayed as a search result.core/modules/node/node.api.phpd10,d9,d8,d7
hook_node_update_indexAct on a node being indexed for searching.core/modules/node/node.api.phpd10,d9,d8,d7
hook_query_alterPerform alterations to a structured query.core/lib/Drupal/Core/Database/database.api.phpd10,d9,d8,d7
hook_query_TAG_alterPerform alterations to a structured query for a given tag.core/lib/Drupal/Core/Database/database.api.phpd10,d9,d8,d7
hook_rankingProvide additional methods of scoring for core search results for nodes.core/modules/node/node.api.phpd10,d9,d8,d7
hook_requirementsCheck installation requirements and do status reporting.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_schemaDefine the current version of the database schema.core/lib/Drupal/Core/Database/database.api.phpd10,d9,d8,d7
hook_search_preprocessPreprocess text for search.core/modules/search/search.api.phpd10,d9,d8,d7
hook_shortcut_default_setReturn the name of a default shortcut set for the provided user account.core/modules/shortcut/shortcut.api.phpd10,d9,d8,d7
hook_system_info_alterAlter the information parsed from module and theme .info.yml files.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_system_themes_page_alterAlters theme operation links.core/modules/system/system.api.phpd10,d9,d8,d7
hook_themeRegister a module or theme's theme implementations.core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8,d7
hook_theme_registry_alterAlter the theme registry information returned from hook_theme().core/lib/Drupal/Core/Render/theme.api.phpd10,d9,d8,d7
hook_token_infoProvide information about available placeholder tokens and token types.core/lib/Drupal/Core/Utility/token.api.phpd10,d9,d8,d7
hook_token_info_alterAlter the metadata about available placeholder tokens and token types.core/lib/Drupal/Core/Utility/token.api.phpd10,d9,d8,d7
hook_tokensProvide replacement values for placeholder tokens.core/lib/Drupal/Core/Utility/token.api.phpd10,d9,d8,d7
hook_tokens_alterAlter replacement values for placeholder tokens.core/lib/Drupal/Core/Utility/token.api.phpd10,d9,d8,d7
hook_uninstallRemove any information that the module sets.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_update_dependenciesReturn an array of information about module update dependencies.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_update_last_removedReturn a number which is no longer available as hook_update_N().core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_update_NPerform a single update between minor versions.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_update_projects_alterAlter the list of projects before fetching data and comparing versions.core/modules/update/update.api.phpd10,d9,d8,d7
hook_update_status_alterAlter the information about available updates for projects.core/modules/update/update.api.phpd10,d9,d8,d7
hook_updater_infoProvide information on Updaters (classes that can update Drupal).core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_updater_info_alterAlter the Updater information array.core/lib/Drupal/Core/Extension/module.api.phpd10,d9,d8,d7
hook_user_cancelAct on user account cancellations.core/modules/user/user.api.phpd10,d9,d8,d7
hook_user_cancel_methods_alterModify account cancellation methods.core/modules/user/user.api.phpd10,d9,d8,d7
hook_user_loginThe user just logged in.core/modules/user/user.api.phpd10,d9,d8,d7
hook_user_logoutThe user just logged out.core/modules/user/user.api.phpd10,d9,d8,d7
hook_verify_update_archiveVerify an archive after it has been downloaded and extracted.core/modules/update/update.api.phpd10,d9,d8,d7

タイトルとURLをコピーしました