public static function WeMegaMenuBuilder::getAllBlocks in Drupal Mega Menu 8
Same name and namespace in other branches
- 8.x src/WeMegaMenuBuilder.php \Drupal\we_megamenu\WeMegaMenuBuilder::getAllBlocks()
Get all block of drupal.
@staticvar array $_list_blocks_array
Return value
array Public static function getAllBlocks array list_blocks_array.
3 calls to WeMegaMenuBuilder::getAllBlocks()
- WeMegaMenuAdminController::configWeMegaMenu in src/
Controller/ WeMegaMenuAdminController.php - A function build page backend.
- WeMegaMenuBlock::build in src/
Plugin/ Block/ WeMegaMenuBlock.php - Builds and returns the renderable array for this block plugin.
- WeMegaMenuBuilder::renderWeMegaMenuBlock in src/
WeMegaMenuBuilder.php - Render Drupal 8 Mega Menu blocks.
File
- src/
WeMegaMenuBuilder.php, line 196
Class
Namespace
Drupal\we_megamenuCode
public static function getAllBlocks() {
static $_list_blocks_array = [];
if (empty($_list_blocks_array)) {
$theme_default = Drupal::config('system.theme')
->get('default');
$block_storage = Drupal::entityTypeManager()
->getStorage('block');
$entity_ids = $block_storage
->getQuery()
->condition('theme', $theme_default)
->execute();
$entities = $block_storage
->loadMultiple($entity_ids);
$_list_blocks_array = [];
foreach ($entities as $block_id => $block) {
if ($block
->get('settings')['provider'] != 'we_megamenu') {
$_list_blocks_array[$block_id] = $block
->label();
}
}
asort($_list_blocks_array);
}
return $_list_blocks_array;
}