(Drupal 8.2.4, using a custom theme that has 'stable' as the base.)

I'm not sure if I've broken something, but (having rebuilt the cache etc.) the FILE NAME SUGGESTIONS section is missing entirely from the Twig debugging for view pages:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view' -->
<!-- BEGIN OUTPUT from 'core/themes/stable/templates/views/views-view.html.twig' -->

… when I copy the template from stable to my theme and give it a more specific filename (for a view with a machine name of "gifts"), I get this:

<!-- FILE NAME SUGGESTIONS:
   x views-view--gifts.html.twig
   x views-view--gifts.html.twig
   * views-view.html.twig
-->

which:

a) doesn't list any of the other options (i.e. ID, display type)
b) has the same entry repeated twice

Any ideas?

Issue fork drupal-2839945

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wturrell created an issue. See original summary.

wturrell’s picture

Issue summary: View changes

Remove question about listing possible templates in UI, as supposedly views_templates module does that – unable to install it, will ask elsewhere

Lendude’s picture

Title: File name suggestions often missing from Twig debugging? » Views file name suggestions often missing from Twig debugging
Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.4.x-dev
Component: Miscellaneous » views.module

@wturrell not a clue about what's going on, but moving this to the right queue.

bobthebuilder’s picture

I'm having the same issue with Drupal 8.3 and I'm using the Bootstrap theme as the base module:

<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view' -->
<!-- BEGIN OUTPUT from 'sites/all/themes/bootstrap/templates/views/views-view.html.twig' -->
<div class="view view-paragraph-news-listings view-id-paragraph_news_listings view-display-id-paragraph_news_listings_page js-view-dom-id-dd4f956a8b1b10f46748a20333105731585c11cc58ff9e1c0f267d126b3e2f6d">
bapi_22’s picture

Thease are the list of templates provided by views core but it's not included in the theme hook suggestions.

views-view--foobar--page.html.twig
views-view--page.html.twig
views-view--foobar.html.twig
views-view.html.twig

views-view-unformatted--foobar--page.html.twig
views-view-unformatted--page.html.twig
views-view-unformatted--foobar.html.twig
views-view-unformatted.html.twig

views-view-fields--foobar--page.html.twig
views-view-fields--page.html.twig
views-view-fields--foobar.html.twig
views-view-fields.html.twig

bapi_22’s picture

Status: Active » Needs review
FileSize
805 bytes

Hi,

This patch will create possible template suggestions for views template.

In same way we can create suggestion for views display and views field templates.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

kdechant’s picture

The patch in #6 worked perfectly for me when I encountered this issue.

Oddly, some of my views were affected while others weren't. I'm not 100% sure why. The one that worked was Solr-backed and the one missing the suggestions was a regular SQL-backed view with a relationship to an Entityqueue. Not sure if that provides any useful info.

Anonymous’s picture

#6 nice patch! But looks like this issue is duplicate of #2923634: [PP-1] Use hook_theme_suggestions in views, where the problem is solved by eliminating the root cause.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

komlenic’s picture

The file name suggestions in #5 have been invaluable until this is fixed. Thanks.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

alphex made their first commit to this issue’s fork.

Lendude’s picture

Status: Needs review » Closed (duplicate)

Closing this as a duplicate of #2923634: [PP-1] Use hook_theme_suggestions in views, if you feel this is addressing a different issue, feel free to reopen this.