You are here

class PrepareLayoutEvent in Drupal 9

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\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

Namesort descending Modifiers Type Description Overrides
PrepareLayoutEvent::$sectionStorage protected property The section storage plugin.
PrepareLayoutEvent::getSectionStorage public function Gets the section storage.
PrepareLayoutEvent::__construct public function Constructs a new PrepareLayoutEvent.