class EntityBuildDefaultsAlterEvent in Hook Event Dispatcher 8
Class EntityBuildDefaultsAlterEvent.
Hierarchy
- class \Drupal\hook_event_dispatcher\Event\Entity\BaseEntityEvent extends \Symfony\Component\EventDispatcher\Event implements EventInterface
- class \Drupal\hook_event_dispatcher\Event\Entity\EntityBuildDefaultsAlterEvent
Expanded class hierarchy of EntityBuildDefaultsAlterEvent
2 files declare their use of EntityBuildDefaultsAlterEvent
- EntityViewEventTest.php in tests/
src/ Unit/ Entity/ EntityViewEventTest.php - hook_event_dispatcher.module in ./
hook_event_dispatcher.module - Hook event dispatcher module.
File
- src/
Event/ Entity/ EntityBuildDefaultsAlterEvent.php, line 11
Namespace
Drupal\hook_event_dispatcher\Event\EntityView source
class EntityBuildDefaultsAlterEvent extends BaseEntityEvent {
/**
* A renderable array representing the entity content.
*
* @var array
*/
private $build;
/**
* The view mode.
*
* @var string
*/
private $viewMode;
/**
* EntityBuildDefaultsAlterEvent constructor.
*
* @param array &$build
* A renderable array representing the entity content. It will not have
* other elements aside from the entity and a #cache parameter. The
* structure of $build is a renderable array as expected by drupal_render().
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity object.
* @param string $viewMode
* The view mode the entity is rendered in.
*/
public function __construct(array &$build, EntityInterface $entity, string $viewMode) {
parent::__construct($entity);
$this->build =& $build;
$this->viewMode = $viewMode;
}
/**
* Get the build.
*
* @return array
* The build.
*/
public function &getBuild() {
return $this->build;
}
/**
* Get the view mode.
*
* @return string
* The view mode.
*/
public function getViewMode() {
return $this->viewMode;
}
/**
* {@inheritdoc}
*/
public function getDispatcherType() {
return HookEventDispatcherInterface::ENTITY_BUILD_DEFAULTS_ALTER;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BaseEntityEvent:: |
protected | property | The Entity. | |
BaseEntityEvent:: |
public | function | Get the Entity. | |
BaseEntityEvent:: |
public | function | Set the Entity. | |
EntityBuildDefaultsAlterEvent:: |
private | property | A renderable array representing the entity content. | |
EntityBuildDefaultsAlterEvent:: |
private | property | The view mode. | |
EntityBuildDefaultsAlterEvent:: |
public | function | Get the build. | |
EntityBuildDefaultsAlterEvent:: |
public | function |
Get the dispatcher type. Overrides EventInterface:: |
|
EntityBuildDefaultsAlterEvent:: |
public | function | Get the view mode. | |
EntityBuildDefaultsAlterEvent:: |
public | function |
EntityBuildDefaultsAlterEvent constructor. Overrides BaseEntityEvent:: |