Mercurial > hg > isophonics-drupal-site
annotate core/modules/layout_builder/src/Controller/LayoutBuilderController.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | af1871eacc83 |
children |
rev | line source |
---|---|
Chris@14 | 1 <?php |
Chris@14 | 2 |
Chris@14 | 3 namespace Drupal\layout_builder\Controller; |
Chris@14 | 4 |
Chris@14 | 5 use Drupal\Core\StringTranslation\StringTranslationTrait; |
Chris@14 | 6 use Drupal\layout_builder\SectionStorageInterface; |
Chris@14 | 7 |
Chris@14 | 8 /** |
Chris@14 | 9 * Defines a controller to provide the Layout Builder admin UI. |
Chris@14 | 10 * |
Chris@14 | 11 * @internal |
Chris@18 | 12 * Controller classes are internal. |
Chris@14 | 13 */ |
Chris@18 | 14 class LayoutBuilderController { |
Chris@14 | 15 |
Chris@14 | 16 use StringTranslationTrait; |
Chris@14 | 17 |
Chris@14 | 18 /** |
Chris@14 | 19 * Provides a title callback. |
Chris@14 | 20 * |
Chris@14 | 21 * @param \Drupal\layout_builder\SectionStorageInterface $section_storage |
Chris@14 | 22 * The section storage. |
Chris@14 | 23 * |
Chris@14 | 24 * @return string |
Chris@14 | 25 * The title for the layout page. |
Chris@14 | 26 */ |
Chris@14 | 27 public function title(SectionStorageInterface $section_storage) { |
Chris@14 | 28 return $this->t('Edit layout for %label', ['%label' => $section_storage->label()]); |
Chris@14 | 29 } |
Chris@14 | 30 |
Chris@14 | 31 /** |
Chris@14 | 32 * Renders the Layout UI. |
Chris@14 | 33 * |
Chris@14 | 34 * @param \Drupal\layout_builder\SectionStorageInterface $section_storage |
Chris@14 | 35 * The section storage. |
Chris@14 | 36 * |
Chris@14 | 37 * @return array |
Chris@14 | 38 * A render array. |
Chris@14 | 39 */ |
Chris@18 | 40 public function layout(SectionStorageInterface $section_storage) { |
Chris@14 | 41 return [ |
Chris@18 | 42 '#type' => 'layout_builder', |
Chris@18 | 43 '#section_storage' => $section_storage, |
Chris@14 | 44 ]; |
Chris@14 | 45 } |
Chris@14 | 46 |
Chris@14 | 47 } |