1 layout_renderer_standard.inc LayoutRendererStandard::renderRegions()

Render all prepared regions, placing already-rendered blocks into their appropriate positions therein.

Return value

array: An array of rendered layout regions, keyed on the region name.

File

core/modules/layout/plugins/renderers/layout_renderer_standard.inc, line 558

Class

LayoutRendererStandard
The standard render for a Layout display object.

Code

function renderRegions() {
  $this->rendered['regions'] = array();

  // Loop through all layout regions, put all blocks that belong to the
  // current region in an array, then render the region. Primarily this
  // ensures that the blocks are arranged in the proper order.
  foreach ($this->prepared['regions'] as $region_id => $conf) {
    $region_blocks = array();
    foreach ($conf['uuids'] as $uuid) {
      // Only include blocks for region rendering if they had some output.
      if (!empty($this->rendered['blocks'][$uuid])) {
        $region_blocks[$uuid] = $this->rendered['blocks'][$uuid];
      }
    }
    $this->rendered['regions'][$region_id] = $this->renderRegion($region_id, $region_blocks);
  }

  return $this->rendered['regions'];
}