This project is not covered by Drupal’s security advisory policy.

The custom_suggestions_hook_theme_suggestions_HOOK_alter is a pre-process function that allows us to easily produce custom template suggestions based on an existing hook. For instance, if we wanted to alter the theme suggestions for all of our Pages, then we could use custom_suggestions_hook_theme_suggestions_page_alter(). We can leverage a $suggestions[] array to produce a number of template suggestions for whichever element we specify in the function’s title. In order to edit the
element in our “custom_suggestions_hook” theme/module, we want to modify the function to the following:

example hook html alter:

/**
 * Implements hook_theme_suggestions_html_alter().
 */
function custom_suggestions_hook_theme_suggestions_html_alter(array &$suggestions, array $variables, $hook)
{
  if ($node = \Drupal::routeMatch()->getParameter('node')) {
    $suggestions[] = $hook . '__' . $node->bundle();
  }
}

Project information

Releases