Rick
Rick

Reputation: 1559

Twig template file not recognized

I have a page-view that prints "Fields" as "unformatted list". I am trying to name my view after adding the below suggestion on the .theme file:

function mytheme_theme_suggestions_views_view_fields_alter(array &$suggestions, array $variables) {
  $view_name = $variables['view']->id();
  $view_display = $variables['view']->current_display;
  if ($view_name && $view_display) {
    $suggestions[] = $variables['theme_hook_original'] . '__' . $view_name . '__' . $view_display;
  }

According to the suggestion the twig file is named as : views_view_field__my_view__page__1.html.twig

But the template is not getting recognized. View name is my_view. Can someone help on correcting my view twig template name?

Upvotes: 0

Views: 611

Answers (1)

valerogarte
valerogarte

Reputation: 156

You can disable the cache and enable debug mode with this instructions.

Besides, you can confirm that your param in the hook is OK:

enter image description here

Dont forget to rename mytheme for your real name in the function.

Upvotes: 1

Related Questions