class LayoutBuilderController in Drupal 10
Same name and namespace in other branches
- 8 core/modules/layout_builder/src/Controller/LayoutBuilderController.php \Drupal\layout_builder\Controller\LayoutBuilderController
- 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
- class \Drupal\layout_builder\Controller\LayoutBuilderController uses StringTranslationTrait
Expanded class hierarchy of LayoutBuilderController
File
- core/
modules/ layout_builder/ src/ Controller/ LayoutBuilderController.php, line 15
Namespace
Drupal\layout_builder\ControllerView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LayoutBuilderController:: |
public | function | Renders the Layout UI. | |
LayoutBuilderController:: |
public | function | Provides a title callback. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 3 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 1 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |