1<?php 2 3namespace Drupal\layout_builder\Controller; 4 5use Drupal\Core\StringTranslation\StringTranslationTrait; 6use Drupal\layout_builder\SectionStorageInterface; 7 8/** 9 * Defines a controller to provide the Layout Builder admin UI. 10 * 11 * @internal 12 * Controller classes are internal. 13 */ 14class LayoutBuilderController { 15 16 use StringTranslationTrait; 17 18 /** 19 * Provides a title callback. 20 * 21 * @param \Drupal\layout_builder\SectionStorageInterface $section_storage 22 * The section storage. 23 * 24 * @return string 25 * The title for the layout page. 26 */ 27 public function title(SectionStorageInterface $section_storage) { 28 return $this->t('Edit layout for %label', ['%label' => $section_storage->label()]); 29 } 30 31 /** 32 * Renders the Layout UI. 33 * 34 * @param \Drupal\layout_builder\SectionStorageInterface $section_storage 35 * The section storage. 36 * 37 * @return array 38 * A render array. 39 */ 40 public function layout(SectionStorageInterface $section_storage) { 41 return [ 42 '#type' => 'layout_builder', 43 '#section_storage' => $section_storage, 44 ]; 45 } 46 47} 48