class SectionComponentBuildRenderArrayEvent extends Event (View source)

Event fired when a section component's render array is being built.

Subscribers to this event should manipulate the cacheability object and the build array in this event.

Traits

Provides an implementation of CacheableResponseInterface.

Properties

protected CacheableMetadata $cacheabilityMetadata

The cacheability metadata.

from  CacheableResponseTrait
protected SectionComponent $component

The section component whose render array is being built.

protected ContextInterface[] $contexts

The available contexts.

protected PluginInspectionInterface $plugin

The plugin for the section component being built.

protected bool $inPreview

Whether the component is in preview mode or not.

protected array $build

The render array built by the event subscribers.

Methods

addCacheableDependency($dependency)

{@inheritdoc}

__construct(SectionComponent $component, array $contexts, bool $in_preview = FALSE)

Creates a new SectionComponentBuildRenderArrayEvent object.

getComponent()

Get the section component whose render array is being built.

getContexts()

Get the available contexts.

getPlugin()

Get the plugin for the section component being built.

bool
inPreview()

Determine if the component is in preview mode.

array
getBuild()

Get the render array in its current state.

setBuild(array $build)

Set the render array.

Details

addCacheableDependency($dependency)

{@inheritdoc}

Parameters

$dependency

getCacheableMetadata()

{@inheritdoc}

__construct(SectionComponent $component, array $contexts, bool $in_preview = FALSE)

Creates a new SectionComponentBuildRenderArrayEvent object.

Parameters

SectionComponent $component

The section component whose render array is being built.

array $contexts

The available contexts.

bool $in_preview

(optional) Whether the component is in preview mode or not.

SectionComponent getComponent()

Get the section component whose render array is being built.

Return Value

SectionComponent

The section component whose render array is being built.

array|ContextInterface[] getContexts()

Get the available contexts.

Return Value

array|ContextInterface[]

The available contexts.

PluginInspectionInterface getPlugin()

Get the plugin for the section component being built.

Return Value

PluginInspectionInterface

The plugin for the section component being built.

bool inPreview()

Determine if the component is in preview mode.

Return Value

bool

Whether the component is in preview mode or not.

array getBuild()

Get the render array in its current state.

Return Value

array

The render array built by the event subscribers.

setBuild(array $build)

Set the render array.

Parameters

array $build

A render array.