Skip to content

Instantly share code, notes, and snippets.

@robertbakker
Created July 30, 2016 22:17
Show Gist options
  • Select an option

  • Save robertbakker/5a2ed74a5d7cbc36d70e7768eafad9ac to your computer and use it in GitHub Desktop.

Select an option

Save robertbakker/5a2ed74a5d7cbc36d70e7768eafad9ac to your computer and use it in GitHub Desktop.
core: 8.x
type: module
name: Taxonomy Suggestions
description: 'Provides extra theme template suggestions for display modes of taxonomy terms'
version: 1.0
<?php
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function taxonomy_suggestions_theme_suggestions_taxonomy_term_alter(array &$suggestions, array $variables)
{
$term = $variables['elements']['#taxonomy_term'];
$view_mode = $variables['elements']['#view_mode'];
$suggestions[] = 'taxonomy_term__' . $term->bundle() . '__' . $view_mode;
$suggestions[] = 'taxonomy_term__' . $view_mode;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment