function SectionComponentBuildRenderArrayEvent::__construct

Same name in other branches
  1. 9 core/modules/layout_builder/src/Event/SectionComponentBuildRenderArrayEvent.php \Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent::__construct()
  2. 8.9.x core/modules/layout_builder/src/Event/SectionComponentBuildRenderArrayEvent.php \Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent::__construct()
  3. 11.x core/modules/layout_builder/src/Event/SectionComponentBuildRenderArrayEvent.php \Drupal\layout_builder\Event\SectionComponentBuildRenderArrayEvent::__construct()

Creates a new SectionComponentBuildRenderArrayEvent object.

Parameters

\Drupal\layout_builder\SectionComponent $component: The section component whose render array is being built.

\Drupal\Core\Plugin\Context\ContextInterface[] $contexts: The available contexts.

bool $in_preview: (optional) Whether the component is in preview mode or not.

File

core/modules/layout_builder/src/Event/SectionComponentBuildRenderArrayEvent.php, line 67

Class

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

Namespace

Drupal\layout_builder\Event

Code

public function __construct(SectionComponent $component, array $contexts, $in_preview = FALSE) {
    $this->component = $component;
    $this->contexts = $contexts;
    $this->plugin = $component->getPlugin($contexts);
    $this->inPreview = $in_preview;
    if ($this->plugin instanceof PreviewAwarePluginInterface) {
        $this->plugin
            ->setInPreview($in_preview);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.