class EntityOperationEvent in Hook Event Dispatcher 8
Class EntityLoadEvent.
Hierarchy
- class \Drupal\hook_event_dispatcher\Event\Entity\EntityOperationEvent extends \Symfony\Component\EventDispatcher\Event implements EventInterface
Expanded class hierarchy of EntityOperationEvent
2 files declare their use of EntityOperationEvent
- EntityOperationsTest.php in tests/
src/ Unit/ Entity/ EntityOperationsTest.php - hook_event_dispatcher.module in ./
hook_event_dispatcher.module - Hook event dispatcher module.
File
- src/
Event/ Entity/ EntityOperationEvent.php, line 13
Namespace
Drupal\hook_event_dispatcher\Event\EntityView source
class EntityOperationEvent extends Event implements EventInterface {
/**
* The operations.
*
* @var array
*/
private $operations;
/**
* The entity.
*
* @var \Drupal\Core\Entity\EntityInterface
*/
private $entity;
/**
* EntityOperationEvent constructor.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity.
*/
public function __construct(EntityInterface $entity) {
$this->entity = $entity;
}
/**
* Get the entity.
*
* @return \Drupal\Core\Entity\EntityInterface
* The entity.
*/
public function getEntity() {
return $this->entity;
}
/**
* Get the operations.
*
* @return array
* The operations.
*/
public function getOperations() {
return $this->operations;
}
/**
* Set the operations.
*
* @param array $operations
* An array of operations.
*/
public function setOperations(array $operations) {
$this->operations = $operations;
}
/**
* Add an operation.
*
* @param string $name
* Operation name.
* @param array $operation
* Operation definition.
*/
public function addOperation($name, array $operation) {
$this->operations[$name] = $operation;
}
/**
* {@inheritdoc}
*/
public function getDispatcherType() {
return HookEventDispatcherInterface::ENTITY_OPERATION;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityOperationEvent:: |
private | property | The entity. | |
EntityOperationEvent:: |
private | property | The operations. | |
EntityOperationEvent:: |
public | function | Add an operation. | |
EntityOperationEvent:: |
public | function |
Get the dispatcher type. Overrides EventInterface:: |
|
EntityOperationEvent:: |
public | function | Get the entity. | |
EntityOperationEvent:: |
public | function | Get the operations. | |
EntityOperationEvent:: |
public | function | Set the operations. | |
EntityOperationEvent:: |
public | function | EntityOperationEvent constructor. |