You are here

class LayoutBuilderController in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/layout_builder/src/Controller/LayoutBuilderController.php \Drupal\layout_builder\Controller\LayoutBuilderController
  2. 9 core/modules/layout_builder/src/Controller/LayoutBuilderController.php \Drupal\layout_builder\Controller\LayoutBuilderController

Defines a controller to provide the Layout Builder admin UI.

@internal Controller classes are internal.

Hierarchy

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

Namesort descending Modifiers Type Description Overrides
LayoutBuilderController::layout public function Renders the Layout UI.
LayoutBuilderController::title public function Provides a title callback.
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
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. 1
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.