Last active
September 24, 2017 22:08
-
-
Save laradevitt/86644e692492cc04e3d6e693598dc307 to your computer and use it in GitHub Desktop.
(Drupal 8.x) Provide template suggestions for custom block types.
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(). | |
* | |
* Original source: @jeff-burnz https://www.drupal.org/node/2724333#comment-11184655 | |
*/ | |
function mytheme_theme_suggestions_block_alter(array &$suggestions, array $vars) { | |
// Template suggestions for custom block bundles. | |
if (isset($vars['elements']['content']['#block_content'])) { | |
array_splice($suggestions, 1, 0, 'block__bundle__' . $vars['elements']['content']['#block_content']->bundle()); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment