function LayoutBuilder::layout
Renders the Layout UI.
Parameters
\Drupal\layout_builder\SectionStorageInterface $section_storage: The section storage.
Return value
array A render array.
1 call to LayoutBuilder::layout()
- LayoutBuilder::preRender in core/modules/ layout_builder/ src/ Element/ LayoutBuilder.php 
- Pre-render callback: Renders the Layout Builder UI.
File
- 
              core/modules/ layout_builder/ src/ Element/ LayoutBuilder.php, line 100 
Class
- LayoutBuilder
- Defines a render element for building the Layout Builder UI.
Namespace
Drupal\layout_builder\ElementCode
protected function layout(SectionStorageInterface $section_storage) {
  $this->prepareLayout($section_storage);
  $output = [];
  if ($this->isAjax()) {
    $output['status_messages'] = [
      '#type' => 'status_messages',
    ];
  }
  $count = 0;
  for ($i = 0; $i < $section_storage->count(); $i++) {
    $output[] = $this->buildAddSectionLink($section_storage, $count);
    $output[] = $this->buildAdministrativeSection($section_storage, $count);
    $count++;
  }
  $output[] = $this->buildAddSectionLink($section_storage, $count);
  $output['#attached']['library'][] = 'layout_builder/drupal.layout_builder';
  // As the Layout Builder UI is typically displayed using the frontend theme,
  // it is not marked as an administrative page at the route level even though
  // it performs an administrative task. Mark this as an administrative page
  // for JavaScript.
  $output['#attached']['drupalSettings']['path']['currentPathIsAdmin'] = TRUE;
  $output['#type'] = 'container';
  $output['#attributes']['id'] = 'layout-builder';
  $output['#attributes']['class'][] = 'layout-builder';
  // Mark this UI as uncacheable.
  $output['#cache']['max-age'] = 0;
  return $output;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
