Last active
July 12, 2018 15:41
-
-
Save leahtard/cb3e7860a885fe69ad9f to your computer and use it in GitHub Desktop.
Create TWIG template suggestions for Drupal 8 custom block types. Enables block--custom-block-type.html.twig
This file contains 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
function basic_theme_suggestions_block_alter(array &$suggestions, array $variables) { | |
$block = $variables['elements']; | |
$blockType = $block['#configuration']['provider']; | |
if ($blockType == "block_content") { | |
$bundle = $block['content']['#block_content']->bundle(); | |
$suggestions[] = 'block__' . $bundle; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment