class EntityViewEvent in Hook Event Dispatcher 8
Class EntityViewEvent.
Hierarchy
- class \Drupal\hook_event_dispatcher\Event\Entity\BaseEntityEvent extends \Symfony\Component\EventDispatcher\Event implements EventInterface
- class \Drupal\hook_event_dispatcher\Event\Entity\EntityViewEvent
Expanded class hierarchy of EntityViewEvent
3 files declare their use of EntityViewEvent
- EntityViewEventTest.php in tests/
src/ Unit/ Entity/ EntityViewEventTest.php - ExampleEntityEventSubscribers.php in src/
Example/ ExampleEntityEventSubscribers.php - hook_event_dispatcher.module in ./
hook_event_dispatcher.module - Hook event dispatcher module.
File
- src/
Event/ Entity/ EntityViewEvent.php, line 12
Namespace
Drupal\hook_event_dispatcher\Event\EntityView source
class EntityViewEvent extends BaseEntityEvent {
/**
* A renderable array representing the entity content.
*
* @var array
*/
protected $build;
/**
* The entity view display.
*
* @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface
*/
protected $display;
/**
* The view mode.
*
* @var string
*/
protected $viewMode;
/**
* EntityViewEvent constructor.
*
* @param array &$build
* A renderable array representing the entity content. The module may add
* elements to $build prior to rendering. The structure of $build is a
* renderable array as expected by drupal_render().
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity object.
* @param \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display
* The entity view display holding the display options configured for the
* entity components.
* @param string $viewMode
* The view mode the entity is rendered in.
*/
public function __construct(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $viewMode) {
parent::__construct($entity);
$this->build =& $build;
$this->display = $display;
$this->viewMode = $viewMode;
}
/**
* Get the build.
*
* @return array
* The build.
*/
public function &getBuild() {
return $this->build;
}
/**
* Set the build.
*
* @param array $build
* The build.
*
* @deprecated This is not needed, this array is passed by reference.
*/
public function setBuild(array $build) {
$this->build = $build;
}
/**
* Get the display.
*
* @return \Drupal\Core\Entity\Display\EntityViewDisplayInterface
* The display.
*/
public function getDisplay() {
return $this->display;
}
/**
* Get the view mode.
*
* @return string
* The view mode.
*/
public function getViewMode() {
return $this->viewMode;
}
/**
* {@inheritdoc}
*/
public function getDispatcherType() {
return HookEventDispatcherInterface::ENTITY_VIEW;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BaseEntityEvent:: |
protected | property | The Entity. | |
BaseEntityEvent:: |
public | function | Get the Entity. | |
BaseEntityEvent:: |
public | function | Set the Entity. | |
EntityViewEvent:: |
protected | property | A renderable array representing the entity content. | |
EntityViewEvent:: |
protected | property | The entity view display. | |
EntityViewEvent:: |
protected | property | The view mode. | |
EntityViewEvent:: |
public | function | Get the build. | |
EntityViewEvent:: |
public | function |
Get the dispatcher type. Overrides EventInterface:: |
|
EntityViewEvent:: |
public | function | Get the display. | |
EntityViewEvent:: |
public | function | Get the view mode. | |
EntityViewEvent:: |
public | function | Set the build. | |
EntityViewEvent:: |
public | function |
EntityViewEvent constructor. Overrides BaseEntityEvent:: |