Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kuflievskiy/c59f2d8105c2a925bcdf1accd8fa1e2c to your computer and use it in GitHub Desktop.
Save kuflievskiy/c59f2d8105c2a925bcdf1accd8fa1e2c to your computer and use it in GitHub Desktop.
Examples theme_suggestions
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'views_view' -->
<!-- FILE NAME SUGGESTIONS:
x views-view--products-page-products.html.twig
* views-view.html.twig
-->
<!-- BEGIN OUTPUT from 'sites/all/themes/brand_theme/templates/views/views-view--products-page-products.html.twig' -->
/**
* Function brand_theme_theme_suggestions_views_view_alter
* @param object $suggestions
* @param object $variables
* Function are used for rewrite 'views_view.html.twig'
*/
function brand_theme_theme_suggestions_views_view_alter(&$suggestions, $variables) {
if ( 'products' != $variables['view']->id() ) {
return;
}
$suggestions[] = 'views_view__products_' . $variables['view']->getDisplay()->display['display_plugin'] . '_' . strtolower( str_replace(' ', '_', $variables['view']->getDisplay()->display['display_options']['title']) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment