0

I need to have suggestions for views to create dedicated template. Actually I've this in my .theme:

function starter_d9_2022_theme_suggestions_views_view_alter(array &$suggestions, array $variables) {
  $suggestions[] = 'views_view__' . $variables['view']->id();
}
function starter_d9_2022_theme_suggestions_views_view_unformatted_alter(array &$suggestions, array $variables) {
  $suggestions[] = 'views_view_unformatted__' . $variables['view']->id();
}
function starter_d9_2022_theme_suggestions_views_view_list_alter(array &$suggestions, array $variables) {
  $suggestions[] = 'views_view_list__' . $variables['view']->id();
}

This provide:

<!-- FILE NAME SUGGESTIONS:
   x views-view--acces-rubriques-2019.html.twig
   x views-view--acces-rubriques-2019.html.twig
   x views-view--acces-rubriques-2019.html.twig
   * views-view.html.twig
-->

File is working,but code inside doesn't display views content. Anyway, I would to use a more specific template, by display like:

views-view--acces-rubriques-2019--list--block-1.html.twig

How can I add this to my actual code ? Regards

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.