Provide a full array of possible themes to try for a given hook.
string $hook: The hook to use. This is the base theme/template name.
\Drupal\views\ViewExecutable $view: The view being rendered.
string|null $display: The display being rendered, if applicable.
function _views_theme_functions($hook, ViewExecutable $view, $display = NULL) {
$themes = array();
if ($display) {
$themes[] = $hook . '__' . $view->storage
->id() . '__' . $display['id'];
$themes[] = $hook . '__' . $display['id'];
// Add theme suggestions for each single tag.
foreach (drupal_explode_tags($view->storage
->get('tag')) as $tag) {
$themes[] = $hook . '__' . preg_replace('/[^a-z0-9]/', '_', strtolower($tag));
}
if ($display['id'] != $display['display_plugin']) {
$themes[] = $hook . '__' . $view->storage
->id() . '__' . $display['display_plugin'];
$themes[] = $hook . '__' . $display['display_plugin'];
}
}
$themes[] = $hook . '__' . $view->storage
->id();
$themes[] = $hook;
return $themes;
}