Last active
September 24, 2017 22:42
-
-
Save laradevitt/1d5f4f41f03be67bbb1219195f5a5458 to your computer and use it in GitHub Desktop.
(Drupal 7.x, 8.x) List blocks by region and theme.
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 | |
// Drupal 7 | |
$blocks = block_list('sidebar_first'); | |
// Drupal 8 - how nice that you can specify a theme! | |
$blocks = entity_load_multiple_by_properties('block', array('theme' => $GLOBALS['theme'], 'region' => 'sidebar_first')); | |
uasort($blocks, 'Drupal\block\Entity\Block::sort'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment