You are here

public function EntityBuildDefaultsAlterEvent::__construct in Hook Event Dispatcher 3.x

Same name and namespace in other branches
  1. 8.2 modules/core_event_dispatcher/src/Event/Entity/EntityBuildDefaultsAlterEvent.php \Drupal\core_event_dispatcher\Event\Entity\EntityBuildDefaultsAlterEvent::__construct()

EntityBuildDefaultsAlterEvent constructor.

Parameters

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().

\Drupal\Core\Entity\EntityInterface $entity: The entity object.

string $viewMode: The view mode the entity is rendered in.

Overrides AbstractEntityEvent::__construct

File

modules/core_event_dispatcher/src/Event/Entity/EntityBuildDefaultsAlterEvent.php, line 39

Class

EntityBuildDefaultsAlterEvent
Class EntityBuildDefaultsAlterEvent.

Namespace

Drupal\core_event_dispatcher\Event\Entity

Code

public function __construct(array &$build, EntityInterface $entity, string $viewMode) {
  parent::__construct($entity);
  $this->build =& $build;
  $this->viewMode = $viewMode;
}