function SectionComponent::toRenderArray
Same name in other branches
- 9 core/modules/layout_builder/src/SectionComponent.php \Drupal\layout_builder\SectionComponent::toRenderArray()
- 8.9.x 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($event, LayoutBuilderEvents::SECTION_COMPONENT_BUILD_RENDER_ARRAY);
$output = $event->getBuild();
$event->getCacheableMetadata()
->applyTo($output);
return $output;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.