Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steffenr/8ffff2247661b6e8f01008cae2c20029 to your computer and use it in GitHub Desktop.
Save steffenr/8ffff2247661b6e8f01008cae2c20029 to your computer and use it in GitHub Desktop.
Custom theme suggestions for container elements in drupal 8
<?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