ept_image_gallery-1.4.2/ept_image_gallery.module
ept_image_gallery.module
<?php
/**
* @file
* Add template for EPT Image Gallery.
*/
/**
* Implements hook_theme().
*/
function ept_image_gallery_gallery_theme($existing, $type, $theme, $path) {
$theme_templates = [];
// Register custom Paragraph field.
$theme_templates['field__paragraph__field_ept_image_gallery__ept_image_gallery'] = [
'base hook' => 'field',
];
return $theme_templates;
}
/**
* Implements hook_theme_suggestions_hook_alter().
*/
function ept_image_gallery_theme_suggestions_field_alter(array &$suggestions, array $variables, $hook) {
$field = $variables['element']['#field_name'];
if ($field == 'field_ept_image_gallery') {
$suggestions[] = 'field__paragraph__field_ept_image_gallery__ept_image_gallery';
}
}
/**
* Implements hook_theme_registry_alter().
*/
function ept_image_gallery_theme_registry_alter(&$theme_registry) {
$ept_module = 'ept_image_gallery';
$module_path = \Drupal::service('extension.list.module')->getPath($ept_module);
$base_theme = 'field';
$theme_registry['field__paragraph__ept_image_gallery__field_ept_image_gallery'] = [
'path' => $module_path . '/templates',
'template' => 'field--paragraph--field-ept-image-gallery--field-ept-image-gallery',
'render element' => $theme_registry[$base_theme]['render element'],
'base hook' => $base_theme,
'type' => 'module',
'theme path' => $module_path,
'preprocess functions' => $theme_registry[$base_theme]['preprocess functions'],
'initial preprocess' => 'template_preprocess_field',
];
}
