Skip to content
Snippets Groups Projects

#3516487 Make sure $is_section is only set to true for layout components.

1 file
+ 9
5
Compare changes
  • Side-by-side
  • Inline
@@ -80,15 +80,19 @@ class LayoutParagraphsAllowedTypesSubscriber implements EventSubscriberInterface
$types = $event->getTypes();
foreach ($templates as $template) {
$skip_template = FALSE;
$is_section = FALSE;
$paragraphs = $template->content->referencedEntities();
// Check if any of the paragraphs in the template are a layout.
foreach ($paragraphs as $paragraph) {
$behaviors = $paragraph->getAllBehaviorSettings();
$is_layout = isset($behaviors['layout_paragraphs']) && array_key_exists('layout', $behaviors['layout_paragraphs']);
if ($is_layout && $max_depth_exceeded) {
// If we are nested past the max depth and any of the paragraphs has a layout_paragraphs behavior, skip this template.
$skip_template = TRUE;
break;
if ($is_layout) {
$is_section = TRUE;
if ($max_depth_exceeded) {
// If we are nested past the max depth and any of the paragraphs has a layout_paragraphs behavior, skip this template.
$skip_template = TRUE;
break;
}
}
}
if ($skip_template) {
@@ -102,7 +106,7 @@ class LayoutParagraphsAllowedTypesSubscriber implements EventSubscriberInterface
'id' => 'me_template_' . $template->id(),
'label' => $template->label(),
'image' => FALSE,
'is_section' => TRUE,
'is_section' => $is_section,
'is_template' => TRUE,
'url_object' => $url,
];
Loading