Created
July 30, 2016 22:17
-
-
Save robertbakker/5a2ed74a5d7cbc36d70e7768eafad9ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| core: 8.x | |
| type: module | |
| name: Taxonomy Suggestions | |
| description: 'Provides extra theme template suggestions for display modes of taxonomy terms' | |
| version: 1.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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