Created
November 28, 2019 07:10
-
-
Save steffenr/8ffff2247661b6e8f01008cae2c20029 to your computer and use it in GitHub Desktop.
Custom theme suggestions for container elements in drupal 8
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_alter() for container. | |
*/ | |
function THEMENAME_theme_suggestions_container_alter(array &$suggestions, array &$variables) | |
{ | |
$name = ''; | |
$type = ''; | |
if (isset($variables['element']['#name'])) { | |
$name = $variables['element']['#name']; | |
} | |
if (isset($variables['element']['#type'])) { | |
$type = $variables['element']['#type']; | |
} | |
$suggestions[] = 'container__' . $type . '__' . $name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment