1 layout_renderer_editor.inc LayoutRendererEditor::renderBlock($block)

Render a block using its designated style.

This method also manages 'title block' functionality, where the title from an individual block can be bubbled up to take over the title for the entire display.

Parameters

Block $block: The block to be rendered.

Return value

string: The rendered block as HTML.

Overrides LayoutRendererStandard::renderBlock

File

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

Class

LayoutRendererEditor

Code

function renderBlock($block) {
  $buttons = $this->getBlockLinks($block);
  $content = $block->getAdminPreview();

  $output = '<div class="layout-editor-block clearfix" id="layout-editor-block-' . $block->uuid . '" data-block-id="' . $block->uuid . '">';
  $output .= '<div class="layout-editor-block-title clearfix">';
  $output .= '<span class="handle"></span><span class="text">' . $block->getAdminTitle() . '</span>';
  if ($buttons) {
    $output .= '<span class="buttons">' . $buttons . '</span>';
  }
  $output .= '</div>'; // layout-block-title
  $output .= '<div class="layout-editor-block-content">' . render($content) . '</div>';
  $output .= '</div>'; // layout-block

  return $output;
}