You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
986 B
29 lines
986 B
<?php |
|
|
|
use Drupal\Core\Render\AttachmentsTrait; |
|
|
|
/** |
|
* Implements hook_page_attachments(). |
|
*/ |
|
function mobile_facets_page_attachments(array &$attachments) { |
|
$attachments['#attached']['library'][] = 'mobile_facets/mobile_facets'; |
|
} |
|
|
|
/** |
|
* Implements hook_theme_registry_alter(). |
|
*/ |
|
function mobile_facets_theme_registry_alter(array &$theme_registry) { |
|
// Get the active theme name (optional: to target a specific theme). |
|
$active_theme = \Drupal::service('theme.manager')->getActiveTheme()->getName(); |
|
|
|
// Optional: Restrict to a specific theme (e.g., 'my_custom_theme') to avoid affecting admin themes. |
|
// if ($active_theme !== 'my_custom_theme') { |
|
// return; |
|
// } |
|
|
|
// Set the path for the 'region' theme hook to your module's templates directory. |
|
if (isset($theme_registry['region']['path'])) { |
|
$module_path = \Drupal::service('extension.list.module')->getPath('mobile_facets'); |
|
$theme_registry['region']['path'] = $module_path . '/templates'; |
|
} |
|
}
|
|
|