transmuter-1.0.0-alpha2/transmuter.module
transmuter.module
<?php
/**
* @file
* Provides the Core hooks and theme registry alter for transmuter module.
*/
/**
* Implements hook_module_implements_alter().
*/
function transmuter_module_implements_alter(array &$implementations, string $hook): void {
if ($hook === 'theme_registry_alter') {
// Move the module's theme_registry_alter to the front of the
// implementations. This module wants to make the transmuter plugins appear
// as close to the normal theme registry callback, and therefore should
// occur before any module hoping to alter the registry (like for layouts).
$implementations = [
'transmuter' => $implementations['transmuter'],
] + $implementations;
}
}
/**
* Implements hook_theme_registry_alter().
*/
function transmuter_theme_registry_alter(array &$theme_registry): void {
/** @var \Drupal\transmuter\ThemeRegistryBuilder $themeRegistryBuilder */
$themeRegistryBuilder = \Drupal::service('transmuter.theme_registry');
// Find the active transmuter plugins to apply to the theme registry hooks.
// This gets called and cached for each theme, and will only apply transmuter
// plugins for all modules and those defined by the current ACTIVE theme.
$themeRegistryBuilder->alterRegistry($theme_registry);
}
