public function toRenderArray(array
$contexts =
[],
$in_preview = FALSE
) { $regions =
[];
foreach ($this->
getComponents() as $component) { if ($output =
$component->
toRenderArray($contexts,
$in_preview)) { $regions[$component->
getRegion()][$component->
getUuid()] =
$output;
} } $layout =
$this->
getLayout($contexts);
if ($layout instanceof PreviewAwarePluginInterface
) { $layout->
setInPreview($in_preview);
} $build =
$layout->
build($regions);
// If an entity was used to build the layout, store it on the build.
if (!Element::
isEmpty($build) &&
isset($contexts['layout_builder.entity'
])) { $build['#entity'
] =
$contexts['layout_builder.entity'
]->
getContextValue();
} return $build;
} /**
* Gets the layout plugin for this section.
*
* @param \Drupal\Core\Plugin\Context\ContextInterface[] $contexts
* An array of available contexts.
*
* @return \Drupal\Core\Layout\LayoutInterface
* The layout plugin.
*/