Last active
October 9, 2017 11:16
-
-
Save fede-green/64236f050752bc5913199630f2b92cc4 to your computer and use it in GitHub Desktop.
Module implementing custom template suggestions altering an already existing hook.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_theme_suggestions_HOOK_alter(). | |
*/ | |
function MYMODULE_theme_suggestions_HOOK_alter(array &$suggestions, array $variables) { | |
array_unshift($suggestions, 'ADD_MY_MODULE_SUGGESTION'); | |
} | |
/** | |
* Implements hook_theme_registry_alter(). | |
*/ | |
function MYMODULE_theme_registry_alter(&$theme_registry) { | |
// Adding this modules's templates to the bunch. | |
// Html.html.twig | |
$theme_registry['ADD_MY_MODULE_SUGGESTION'] = $theme_registry['html']; | |
$theme_registry['ADD_MY_MODULE_SUGGESTION']['path'] = drupal_get_path('module', 'MYMODULE') . '/templates'; | |
$theme_registry['ADD_MY_MODULE_SUGGESTION']['template'] = 'MY--TEMPLATE'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment