Created
May 9, 2019 23:30
-
-
Save sheanhoxie/6de8dfe3cd076b5a408c697e50413a21 to your computer and use it in GitHub Desktop.
Drupal 8 - Block suggestions for custom block bundles.
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
| https://www.drupal.org/forum/support/theme-development/2016-05-12/theming-custom-block-types#comment-11184655 | |
| /** | |
| * Implements hook_theme_suggestions_HOOK_alter() | |
| * @param array $suggestions | |
| * @param array $variables | |
| */ | |
| function THEMENAME_theme_suggestions_block_alter(array &$suggestions, array $variables) { | |
| // Block suggestions for custom block bundles. | |
| if (isset($variables['elements']['content']['#block_content'])) { | |
| array_splice($suggestions, 1, 0, 'block__bundle__' . $variables['elements']['content']['#block_content']->bundle()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment