protected function Display::sortBlocks

Transform the stored blockConfig into a sorted, region-oriented array.

2 calls to Display::sortBlocks()
Display::getAllSortedBlocks in drupal/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
Implements BoundDisplayInterface::getAllSortedBlocks().
Display::getSortedBlocksByRegion in drupal/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php
Implements BoundDisplayInterface::getSortedBlocksByRegion().

File

drupal/core/modules/layout/lib/Drupal/layout/Plugin/Core/Entity/Display.php, line 104
Definition of Drupal\layout\Plugin\Core\Entity\Display.

Class

Display
Defines the display entity.

Namespace

Drupal\layout\Plugin\Core\Entity

Code

protected function sortBlocks() {
  $layout_instance = $this
    ->getLayoutInstance();
  if ($this->layout !== $layout_instance
    ->getPluginId()) {
    $block_config = $this
      ->mapBlocksToLayout($layout_instance);
  }
  else {
    $block_config = $this->blockInfo;
  }
  $this->blocksInRegions = array();
  $regions = array_fill_keys(array_keys($layout_instance
    ->getRegions()), array());
  foreach ($block_config as $config_name => $info) {
    $regions[$info['region']][$config_name] = $info;
  }
  foreach ($regions as $region_name => &$blocks) {
    uasort($blocks, 'drupal_sort_weight');
    $this->blocksInRegions[$region_name] = array_keys($blocks);
  }
}