protected function LayoutBuilder::prepareLayout in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/src/Element/LayoutBuilder.php \Drupal\layout_builder\Element\LayoutBuilder::prepareLayout()
- 10 core/modules/layout_builder/src/Element/LayoutBuilder.php \Drupal\layout_builder\Element\LayoutBuilder::prepareLayout()
Prepares a layout for use in the UI.
Parameters
\Drupal\layout_builder\SectionStorageInterface $section_storage: The section storage.
1 call to LayoutBuilder::prepareLayout()
- LayoutBuilder::layout in core/
modules/ layout_builder/ src/ Element/ LayoutBuilder.php - Renders the Layout UI.
File
- core/
modules/ layout_builder/ src/ Element/ LayoutBuilder.php, line 147
Class
- LayoutBuilder
- Defines a render element for building the Layout Builder UI.
Namespace
Drupal\layout_builder\ElementCode
protected function prepareLayout(SectionStorageInterface $section_storage) {
// If the layout has pending changes, add a warning.
if ($this->layoutTempstoreRepository
->has($section_storage)) {
$this->messenger
->addWarning($this
->t('You have unsaved changes.'));
}
elseif ($section_storage instanceof OverridesSectionStorageInterface && !$section_storage
->isOverridden()) {
$sections = $section_storage
->getDefaultSectionStorage()
->getSections();
foreach ($sections as $section) {
$section_storage
->appendSection($section);
}
$this->layoutTempstoreRepository
->set($section_storage);
}
}