hook_views_invalidate_cache

hook_views_invalidate_cache() Allow modules to respond to the invalidation of the Views cache. This hook will fire whenever a view is enabled, disabled, created, updated, or deleted. See also views_invalidate_cache() Related topics Hooks Define functions that alter the behavior of Drupal core. File core/modules/views/views.api.php, line 955 Describes hooks and plugins provided by the Views module. Code function hook_views_invalidate_cache() { \Drupal\Core\Cache\Cache::invalidateTags(arra

hook_views_form_substitutions

hook_views_form_substitutions() Replace special strings when processing a view with form elements. Return value array An associative array where each key is a string to be replaced, and the corresponding value is its replacement. The value will be escaped unless it is already marked safe. Related topics Hooks Define functions that alter the behavior of Drupal core. File core/modules/views/views.api.php, line 678 Describes hooks and plugins provided by the Views module. Code function hook_v

hook_views_data_alter

hook_views_data_alter(array &$data) Alter the table and field information from hook_views_data(). Parameters array $data: An array of all information about Views tables and fields, collected from hook_views_data(), passed by reference. See also hook_views_data() Related topics Hooks Define functions that alter the behavior of Drupal core. File core/modules/views/views.api.php, line 451 Describes hooks and plugins provided by the Views module. Code function hook_views_data_alter(array

hook_views_data

hook_views_data() Describe data tables and fields (or the equivalent) to Views. The table and fields are processed in Views using various plugins. See the Views plugins topic for more information. To provide views data for an entity, instead of implementing this hook, create a class implementing \Drupal\views\EntityViewsDataInterface and reference this in the "views" annotation in the entity class. The return value of the getViewsData() method on the interface is the same as this hook, and base

hook_views_analyze

hook_views_analyze(Drupal\views\ViewExecutable $view) Analyze a view to provide warnings about its configuration. Parameters \Drupal\views\ViewExecutable $view: The view being executed. Return value array Array of warning messages built by Analyzer::formatMessage to be displayed to the user following analysis of the view. Related topics Hooks Define functions that alter the behavior of Drupal core. File core/modules/views/views.api.php, line 95 Describes hooks and plugins provided by the Vi

hook_verify_update_archive

hook_verify_update_archive($project, $archive_file, $directory) Verify an archive after it has been downloaded and extracted. Parameters string $project: The short name of the project that has been downloaded. string $archive_file: The filename of the unextracted archive. string $directory: The directory that the archive was extracted into. Return value If there are any problems, return an array of error messages. If there are no problems, return an empty array. See also update_manager_archi

hook_validation_constraint_alter

hook_validation_constraint_alter(array &$definitions) Alter validation constraint plugin definitions. Parameters array[] $definitions: The array of validation constraint definitions, keyed by plugin ID. See also \Drupal\Core\Validation\ConstraintManager \Drupal\Core\Validation\Annotation\Constraint Related topics Hooks Define functions that alter the behavior of Drupal core. File core/core.api.php, line 2249 Documentation landing page and topics, plus core library hooks. Code function

hook_user_logout

hook_user_logout($account) The user just logged out. Parameters $account: The user object on which the operation was just performed. Related topics Hooks Define functions that alter the behavior of Drupal core. File core/modules/user/user.api.php, line 147 Hooks provided by the User module. Code function hook_user_logout($account) { db_insert('logouts') ->fields(array( 'uid' => $account->id(), 'time' => time(), )) ->execute(); }

hook_user_login

hook_user_login($account) The user just logged in. Parameters object $account: The user object on which the operation was just performed. Related topics Hooks Define functions that alter the behavior of Drupal core. File core/modules/user/user.api.php, line 133 Hooks provided by the User module. Code function hook_user_login($account) { $config = \Drupal::config('system.date'); // If the user has a NULL time zone, notify them to set a time zone. if (!$account->getTimezone() &&

hook_user_format_name_alter

hook_user_format_name_alter(&$name, $account) Alter the username that is displayed for a user. Called by $account->getDisplayName() to allow modules to alter the username that is displayed. Can be used to ensure user privacy in situations where $account->getDisplayName() is too revealing. Parameters string $name: The string that $account->getDisplayName() will return. $account: The account object the name belongs to. See also \Drupal\Core\Session\AccountInterface::getDisplayName(