summaryrefslogtreecommitdiffstatshomepage
path: root/core/modules/layout_builder/src/Event/PrepareLayoutEvent.php
blob: c0795be61cb8343d47972f6fa73708d0482de34e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php

namespace Drupal\layout_builder\Event;

use Drupal\layout_builder\SectionStorageInterface;
use Drupal\Component\EventDispatcher\Event;

/**
 * Event fired in #pre_render of \Drupal\layout_builder\Element\LayoutBuilder.
 *
 * Subscribers to this event can prepare section storage before rendering.
 *
 * @see \Drupal\layout_builder\LayoutBuilderEvents::PREPARE_LAYOUT
 * @see \Drupal\layout_builder\Element\LayoutBuilder::prepareLayout()
 */
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;
  }

}