You are here

class BlockBuildAlterEvent in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/core_event_dispatcher/src/Event/Block/BlockBuildAlterEvent.php \Drupal\core_event_dispatcher\Event\Block\BlockBuildAlterEvent

Class BlockBuildAlterEvent.

Hierarchy

Expanded class hierarchy of BlockBuildAlterEvent

2 files declare their use of BlockBuildAlterEvent
BlockEventTest.php in modules/core_event_dispatcher/tests/src/Unit/Block/BlockEventTest.php
core_event_dispatcher.module in modules/core_event_dispatcher/core_event_dispatcher.module
Core event dispatcher submodule.

File

modules/core_event_dispatcher/src/Event/Block/BlockBuildAlterEvent.php, line 13

Namespace

Drupal\core_event_dispatcher\Event\Block
View source
class BlockBuildAlterEvent extends Event implements EventInterface {

  /**
   * The build array.
   *
   * @var array
   */
  private $build;

  /**
   * The block.
   *
   * @var \Drupal\Core\Block\BlockPluginInterface
   */
  private $block;

  /**
   * BlockBuildAlterEvent constructor.
   *
   * @param array $build
   *   The build array.
   * @param \Drupal\Core\Block\BlockPluginInterface $block
   *   The block object.
   */
  public function __construct(array &$build, BlockPluginInterface $block) {
    $this->build =& $build;
    $this->block = $block;
  }

  /**
   * Get the build array.
   *
   * @return array
   *   The build array.
   */
  public function &getBuild() : array {
    return $this->build;
  }

  /**
   * Get the block.
   *
   * @return \Drupal\Core\Block\BlockPluginInterface
   *   The block object.
   */
  public function getBlock() : BlockPluginInterface {
    return $this->block;
  }

  /**
   * {@inheritdoc}
   */
  public function getDispatcherType() : string {
    return HookEventDispatcherInterface::BLOCK_BUILD_ALTER;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockBuildAlterEvent::$block private property The block.
BlockBuildAlterEvent::$build private property The build array.
BlockBuildAlterEvent::getBlock public function Get the block.
BlockBuildAlterEvent::getBuild public function Get the build array.
BlockBuildAlterEvent::getDispatcherType public function Get the dispatcher type. Overrides EventInterface::getDispatcherType
BlockBuildAlterEvent::__construct public function BlockBuildAlterEvent constructor.