1 layout_renderer_editor.inc LayoutRendererEditor::renderRegion($region_id, $blocks)

Render a single layout region.

Primarily just a passthrough to the layout region rendering callback specified by the style plugin that is attached to the current layout region.

Parameters

$region_id: The ID of the layout region being rendered.

$blocks: An array of blocks that are assigned to the region that's being rendered.

Return value

string: The rendered, HTML string output of the passed-in region.

Overrides LayoutRendererStandard::renderRegion

File

core/modules/layout/plugins/renderers/layout_renderer_editor.inc, line 48
Class file to control the main Layout editor.

Class

LayoutRendererEditor

Code

function renderRegion($region_id, $blocks) {
  $render_title_region = TRUE;
  $all_layout_blocks = $this->layout->content;
  foreach ($all_layout_blocks as $block) {
    if ($block->module == 'system' && $block->delta == 'page_components' && ($block->childDelta == 'title' || $block->childDelta == 'title_combo')) {
      $render_title_region = FALSE;
      break;
    }
  }

  $output = '';
  if ($region_id == 'title') {
    if ($render_title_region) {
      return $this->renderTitleRegion($region_id);
    }
    else {
      $output = '<div id="layout-title-region-empty"></div>';
    }
  }
  else {
    $content = implode('', $blocks);
    $region_buttons = $this->getRegionLinks($region_id);

    $output = '<div class="layout-editor-region" id="layout-editor-region-' . $region_id . '" data-region-name="' . $region_id . '">';
    $output .= '<div class="layout-editor-region-title clearfix">';
    $output .= '<h2 class="label">' . check_plain($this->layout_template_info['regions'][$region_id]) . '</h2>';
    $output .= $region_buttons;
    $output .= '</div>';
    $output .= '<div class="layout-editor-region-content">' . $content . '</div>';
    $output .= '</div>';
  }

  return $output;
}