public function SectionComponent::toRenderArray in Drupal 8
Same name and namespace in other branches
- 9 core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::toRenderArray()
- 10 core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::toRenderArray()
Returns the renderable array for this component.
Parameters
\Drupal\Core\Plugin\Context\ContextInterface[] $contexts: An array of available contexts.
bool $in_preview: TRUE if the component is being previewed, FALSE otherwise.
Return value
array A renderable array representing the content of the component.
File
- core/
modules/ layout_builder/ src/ SectionComponent.php, line 88
Class
- SectionComponent
- Provides a value object for a section component.
Namespace
Drupal\layout_builderCode
public function toRenderArray(array $contexts = [], $in_preview = FALSE) {
$event = new SectionComponentBuildRenderArrayEvent($this, $contexts, $in_preview);
$this
->eventDispatcher()
->dispatch(LayoutBuilderEvents::SECTION_COMPONENT_BUILD_RENDER_ARRAY, $event);
$output = $event
->getBuild();
$event
->getCacheableMetadata()
->applyTo($output);
return $output;
}