By roderik on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
3.x
Introduced in version:
3.0.0-beta1
Issue links:
Description:
The custom elements used for a layout's sections (used by Layout Builder), have been renamed from <layout-section> to <drupal-layout>.
Front end code should be updated accordingly, while updating to version 3 of the module.
Alternatively, reverting to the old values can be done with an alter hook:
function MYMODULE_custom_element_entity_alter(CustomElement $custom_element, ContentEntityInterface $entity, string $viewMode) {
// Revert tag names of layout builder sections to version 2.
$slots = $custom_element->getSlots();
if (isset($slots['sections'])) {
// Only change if all "sections" slots contain a nested element with tag "drupal-layout".
$unexpected_value = FALSE;
foreach ($slots['sections'] as $slot) {
if (!isset($slot['content']) || !$slot['content'] instanceof CustomElement
|| $slot['content']->getTag() !== 'drupal-layout') {
$unexpected_value = TRUE;
break;
}
}
if (!$unexpected_value) {
foreach ($slots['sections'] as $slot) {
$slot['content']->setTag('layout-section');
}
}
}
}
Impacts:
Module developers
Themers
Site templates, recipes and distribution developers