Hooks
In Drupal, hooks are the main way to interact with the Drupal core.
In Drupal, hooks are the main way to interact with the Drupal core. Hooks are functions that are called at specific times in the Drupal core. For example, when a node is saved, a hook is called. When a user logs in, a hook is called. When a page is loaded, a hook is called. There are many hooks that are called in Drupal and they are all documented in the Drupal API.
Hooks are called from the module_name.module
file or from the THEME_NAME.theme
file. The module_name.module
file is where you put all the code that is related to the module. The THEME_NAME.theme
file is where you put all the code that is related to the theme.
Templates - hooks that interact with templates
Create template suggestions
Add current path as css class
Get current language
Get base path
Last updated