class EntityFieldAccessEvent in Hook Event Dispatcher 3.x
Same name and namespace in other branches
- 8.2 modules/core_event_dispatcher/src/Event/Entity/EntityFieldAccessEvent.php \Drupal\core_event_dispatcher\Event\Entity\EntityFieldAccessEvent
Class EntityInsertEvent.
Hierarchy
- class \Drupal\core_event_dispatcher\Event\Entity\EntityFieldAccessEvent extends \Symfony\Component\EventDispatcher\Event implements EventInterface
Expanded class hierarchy of EntityFieldAccessEvent
2 files declare their use of EntityFieldAccessEvent
- core_event_dispatcher.module in modules/
core_event_dispatcher/ core_event_dispatcher.module - Core event dispatcher submodule.
- EntityFieldAccessEventTest.php in modules/
core_event_dispatcher/ tests/ src/ Unit/ Entity/ EntityFieldAccessEventTest.php
File
- modules/
core_event_dispatcher/ src/ Event/ Entity/ EntityFieldAccessEvent.php, line 17
Namespace
Drupal\core_event_dispatcher\Event\EntityView source
class EntityFieldAccessEvent extends Event implements EventInterface {
/**
* The operation.
*
* @var string
*/
private $operation;
/**
* The field definition.
*
* @var \Drupal\Core\Field\FieldDefinitionInterface
*/
private $fieldDefinition;
/**
* The account.
*
* @var \Drupal\Core\Session\AccountInterface
*/
private $account;
/**
* The field item list.
*
* @var \Drupal\Core\Field\FieldItemListInterface
*/
private $items;
/**
* Get the access result.
*
* @var \Drupal\Core\Access\AccessResultInterface
*/
private $accessResult;
/**
* EntityFieldAccessEvent constructor.
*
* @param string $operation
* The operation.
* @param \Drupal\Core\Field\FieldDefinitionInterface $fieldDefinition
* The field definition.
* @param \Drupal\Core\Session\AccountInterface $account
* The account interface.
* @param \Drupal\Core\Field\FieldItemListInterface|null $items
* The field item list interface.
*/
public function __construct(string $operation, FieldDefinitionInterface $fieldDefinition, AccountInterface $account, FieldItemListInterface $items = NULL) {
$this->operation = $operation;
$this->fieldDefinition = $fieldDefinition;
$this->account = $account;
$this->items = $items;
$this->accessResult = AccessResultNeutral::neutral();
}
/**
* {@inheritdoc}
*/
public function getDispatcherType() : string {
return HookEventDispatcherInterface::ENTITY_FIELD_ACCESS;
}
/**
* Get the operation.
*
* @return string
* The operation.
*/
public function getOperation() : string {
return $this->operation;
}
/**
* Get the field definition.
*
* @return \Drupal\Core\Field\FieldDefinitionInterface
* The field definition.
*/
public function getFieldDefinition() : FieldDefinitionInterface {
return $this->fieldDefinition;
}
/**
* Get the account interface.
*
* @return \Drupal\Core\Session\AccountInterface
* Account interface.
*/
public function getAccount() : AccountInterface {
return $this->account;
}
/**
* Get the items.
*
* @return \Drupal\Core\Field\FieldItemListInterface
* The items.
*/
public function getItems() : FieldItemListInterface {
return $this->items;
}
/**
* Get the access result.
*
* @return \Drupal\Core\Access\AccessResultInterface
* The access result.
*/
public function getAccessResult() : AccessResultInterface {
return $this->accessResult;
}
/**
* Set the access result.
*
* @param \Drupal\Core\Access\AccessResultInterface $accessResult
* The access result.
*/
public function setAccessResult(AccessResultInterface $accessResult) : void {
$this->accessResult = $accessResult;
}
}