Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. LayoutBuilderController.php

class LayoutBuilderController

Defines a controller to provide the Layout Builder admin UI.

@internal Controller classes are internal.

Hierarchy

  • class \Drupal\layout_builder\Controller\LayoutBuilderController uses \Drupal\Core\StringTranslation\StringTranslationTrait

Expanded class hierarchy of LayoutBuilderController

File

core/modules/layout_builder/src/Controller/LayoutBuilderController.php, line 15

Namespace

Drupal\layout_builder\Controller
View source
class LayoutBuilderController {
    use StringTranslationTrait;
    
    /**
     * Provides a title callback.
     *
     * @param \Drupal\layout_builder\SectionStorageInterface $section_storage
     *   The section storage.
     *
     * @return string
     *   The title for the layout page.
     */
    public function title(SectionStorageInterface $section_storage) {
        assert(Inspector::assertStringable($section_storage->label()), 'Section storage label is expected to be a string.');
        return $this->t('Edit layout for %label', [
            '%label' => $section_storage->label() ?? $section_storage->getStorageType() . ' ' . $section_storage->getStorageId(),
        ]);
    }
    
    /**
     * Renders the Layout UI.
     *
     * @param \Drupal\layout_builder\SectionStorageInterface $section_storage
     *   The section storage.
     *
     * @return array
     *   A render array.
     */
    public function layout(SectionStorageInterface $section_storage) {
        return [
            '#type' => 'layout_builder',
            '#section_storage' => $section_storage,
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary
LayoutBuilderController::layout public function Renders the Layout UI.
LayoutBuilderController::title public function Provides a title callback.
StringTranslationTrait::$stringTranslation protected property The string translation service.
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use.
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
RSS feed
Powered by Drupal