function ViewsHooks::themeSuggestionsNodeAlter

Implements hook_theme_suggestions_HOOK_alter().

File

core/modules/views/src/Hook/ViewsHooks.php, line 226

Class

ViewsHooks
Hook implementations for views.

Namespace

Drupal\views\Hook

Code

public function themeSuggestionsNodeAlter(array &$suggestions, array $variables) {
    $node = $variables['elements']['#node'];
    if (!empty($node->view) && $node->view->storage
        ->id()) {
        $suggestions[] = 'node__view__' . $node->view->storage
            ->id();
        if (!empty($node->view->current_display)) {
            $suggestions[] = 'node__view__' . $node->view->storage
                ->id() . '__' . $node->view->current_display;
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.