You are here

class EntityOperationAlterEvent in Hook Event Dispatcher 3.x

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

Class EntityOperationAlterEvent.

Hierarchy

Expanded class hierarchy of EntityOperationAlterEvent

2 files declare their use of EntityOperationAlterEvent
core_event_dispatcher.module in modules/core_event_dispatcher/core_event_dispatcher.module
Core event dispatcher submodule.
EntityOperationsTest.php in modules/core_event_dispatcher/tests/src/Unit/Entity/EntityOperationsTest.php

File

modules/core_event_dispatcher/src/Event/Entity/EntityOperationAlterEvent.php, line 13

Namespace

Drupal\core_event_dispatcher\Event\Entity
View source
class EntityOperationAlterEvent extends Event implements EventInterface {

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

  /**
   * The entity.
   *
   * @var \Drupal\Core\Entity\EntityInterface
   */
  private $entity;

  /**
   * EntityOperationAlterEvent constructor.
   *
   * @param array $operations
   *   The array of operations being altered.
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The entity.
   */
  public function __construct(array &$operations, EntityInterface $entity) {
    $this->operations =& $operations;
    $this->entity = $entity;
  }

  /**
   * Get the operations.
   *
   * Returned by reference to be modified.
   *
   * @return array
   *   The operations.
   */
  public function &getOperations() : array {
    return $this->operations;
  }

  /**
   * Get the entity.
   *
   * @return \Drupal\Core\Entity\EntityInterface
   *   The entity.
   */
  public function getEntity() : EntityInterface {
    return $this->entity;
  }

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

}

Members

Namesort descending Modifiers Type Description Overrides
EntityOperationAlterEvent::$entity private property The entity.
EntityOperationAlterEvent::$operations private property The operations.
EntityOperationAlterEvent::getDispatcherType public function Get the dispatcher type. Overrides EventInterface::getDispatcherType
EntityOperationAlterEvent::getEntity public function Get the entity.
EntityOperationAlterEvent::getOperations public function Get the operations.
EntityOperationAlterEvent::__construct public function EntityOperationAlterEvent constructor.