htools-8.x-1.x-dev/modules/htools_entity_views_filter/htools_entity_views_filter.module
modules/htools_entity_views_filter/htools_entity_views_filter.module
<?php
/**
* @file
* Contains entity_views_filter.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function htools_entity_views_filter_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the entity_views_filter module.
case 'help.page.entity_views_filter':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Entity form build views exposed filters') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function htools_entity_views_filter_theme() {
$theme = [];
$theme['entity_views_filter'] = [
'render element' => 'elements',
'file' => 'htools_entity_views_filter.page.inc',
'template' => 'entity_views_filter',
];
$theme['entity_views_filter_content_add_list'] = [
'render element' => 'content',
'variables' => ['content' => NULL],
'file' => 'htools_entity_views_filter.page.inc',
];
return $theme;
}
/**
* Implements hook_theme_suggestions_HOOK().
*/
function htools_entity_views_filter_theme_suggestions_entity_views_filter(array $variables) {
$suggestions = [];
$entity = $variables['elements']['#entity_views_filter'];
$sanitized_view_mode = strtr($variables['elements']['#view_mode'], '.', '_');
$suggestions[] = 'entity_views_filter__' . $sanitized_view_mode;
$suggestions[] = 'entity_views_filter__' . $entity->bundle();
$suggestions[] = 'entity_views_filter__' . $entity->bundle() . '__' . $sanitized_view_mode;
$suggestions[] = 'entity_views_filter__' . $entity->id();
$suggestions[] = 'entity_views_filter__' . $entity->id() . '__' . $sanitized_view_mode;
return $suggestions;
}
