class PrepareLayoutEvent

Same name in other branches
  1. 9 core/modules/layout_builder/src/Event/PrepareLayoutEvent.php \Drupal\layout_builder\Event\PrepareLayoutEvent
  2. 10 core/modules/layout_builder/src/Event/PrepareLayoutEvent.php \Drupal\layout_builder\Event\PrepareLayoutEvent

Event fired in #pre_render of \Drupal\layout_builder\Element\LayoutBuilder.

Subscribers to this event can prepare section storage before rendering.

Hierarchy

  • class \Drupal\Component\EventDispatcher\Event extends \Symfony\Contracts\EventDispatcher\Event
    • class \Drupal\layout_builder\Event\PrepareLayoutEvent extends \Drupal\Component\EventDispatcher\Event

Expanded class hierarchy of PrepareLayoutEvent

See also

\Drupal\layout_builder\LayoutBuilderEvents::PREPARE_LAYOUT

\Drupal\layout_builder\Element\LayoutBuilder::prepareLayout()

3 files declare their use of PrepareLayoutEvent
LayoutBuilder.php in core/modules/layout_builder/src/Element/LayoutBuilder.php
PrepareLayout.php in core/modules/layout_builder/src/EventSubscriber/PrepareLayout.php
TestPrepareLayout.php in core/modules/layout_builder/tests/modules/layout_builder_element_test/src/EventSubscriber/TestPrepareLayout.php

File

core/modules/layout_builder/src/Event/PrepareLayoutEvent.php, line 16

Namespace

Drupal\layout_builder\Event
View source
class PrepareLayoutEvent extends Event {
    
    /**
     * The section storage plugin.
     *
     * @var \Drupal\layout_builder\SectionStorageInterface
     */
    protected $sectionStorage;
    
    /**
     * Constructs a new PrepareLayoutEvent.
     *
     * @param \Drupal\layout_builder\SectionStorageInterface $section_storage
     *   The section storage preparing the Layout.
     */
    public function __construct(SectionStorageInterface $section_storage) {
        $this->sectionStorage = $section_storage;
    }
    
    /**
     * Gets the section storage.
     *
     * @return \Drupal\layout_builder\SectionStorageInterface
     *   The section storage.
     */
    public function getSectionStorage() : SectionStorageInterface {
        return $this->sectionStorage;
    }

}

Members

Title Sort descending Modifiers Object type Summary
PrepareLayoutEvent::$sectionStorage protected property The section storage plugin.
PrepareLayoutEvent::getSectionStorage public function Gets the section storage.
PrepareLayoutEvent::__construct public function Constructs a new PrepareLayoutEvent.

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