function EntityDisplayBase::__construct
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::__construct()
- 8.9.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::__construct()
- 11.x core/lib/Drupal/Core/Entity/EntityDisplayBase.php \Drupal\Core\Entity\EntityDisplayBase::__construct()
Overrides ConfigEntityBase::__construct
3 calls to EntityDisplayBase::__construct()
- EntityDisplayBase::__wakeup in core/
lib/ Drupal/ Core/ Entity/ EntityDisplayBase.php - EntityFormDisplay::__construct in core/
lib/ Drupal/ Core/ Entity/ Entity/ EntityFormDisplay.php - Constructs an Entity object.
- EntityViewDisplay::__construct in core/
lib/ Drupal/ Core/ Entity/ Entity/ EntityViewDisplay.php - Constructs an Entity object.
2 methods override EntityDisplayBase::__construct()
- EntityFormDisplay::__construct in core/
lib/ Drupal/ Core/ Entity/ Entity/ EntityFormDisplay.php - Constructs an Entity object.
- EntityViewDisplay::__construct in core/
lib/ Drupal/ Core/ Entity/ Entity/ EntityViewDisplay.php - Constructs an Entity object.
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityDisplayBase.php, line 132
Class
- EntityDisplayBase
- Provides a common base class for entity view and form displays.
Namespace
Drupal\Core\EntityCode
public function __construct(array $values, $entity_type) {
if (!isset($values['targetEntityType']) || !isset($values['bundle'])) {
throw new \InvalidArgumentException('Missing required properties for an EntityDisplay entity.');
}
if (!$this->entityTypeManager()
->getDefinition($values['targetEntityType'])
->entityClassImplements(FieldableEntityInterface::class)) {
throw new \InvalidArgumentException('EntityDisplay entities can only handle fieldable entity types.');
}
$this->renderer = \Drupal::service('renderer');
// A plugin manager and a context type needs to be set by extending classes.
if (!isset($this->pluginManager)) {
throw new \RuntimeException('Missing plugin manager.');
}
if (!isset($this->displayContext)) {
throw new \RuntimeException('Missing display context type.');
}
parent::__construct($values, $entity_type);
$this->originalMode = $this->mode;
$this->init();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.