You are here

function _views_theme_functions in Views (for Drupal 7) 8.3

Same name and namespace in other branches
  1. 6.3 theme/theme.inc \_views_theme_functions()
  2. 6.2 theme/theme.inc \_views_theme_functions()
  3. 7.3 theme/theme.inc \_views_theme_functions()

Provide a full array of possible themes to try for a given hook.

Parameters

$hook: The hook to use. This is the base theme/template name.

$view: The view being rendered.

$display: The display being rendered, if applicable.

1 call to _views_theme_functions()
views_theme_functions in ./views.module
Build a list of theme function names for use most everywhere.

File

theme/theme.inc, line 21
Preprocessors and helper functions to make theming easier.

Code

function _views_theme_functions($hook, ViewExecutable $view, $display = NULL) {
  $themes = array();
  if ($display) {
    $themes[] = $hook . '__' . $view->storage->name . '__' . $display['id'];
    $themes[] = $hook . '__' . $display['id'];

    // Add theme suggestions for each single tag.
    foreach (drupal_explode_tags($view->storage->tag) as $tag) {
      $themes[] = $hook . '__' . preg_replace('/[^a-z0-9]/', '_', strtolower($tag));
    }
    if ($display['id'] != $display['display_plugin']) {
      $themes[] = $hook . '__' . $view->storage->name . '__' . $display['display_plugin'];
      $themes[] = $hook . '__' . $display['display_plugin'];
    }
  }
  $themes[] = $hook . '__' . $view->storage->name;
  $themes[] = $hook;
  return $themes;
}