/**
* {@inheritdoc}
*/
protected function getConstraintObjects() { if (!
$this->
getConstraint('EntityType'
)) { $this->
addConstraint('EntityType',
[ 'type' =>
$this->
getEntityTypeId(),
]);
} return parent::
getConstraintObjects();
} /**
* {@inheritdoc}
*/
protected function getSampleValues() { // Get the constraints from the context's definition.
$constraints =
$this->
getConstraintObjects();
$entity_type_manager = \Drupal::
entityTypeManager();
$entity_type_id =
$this->
getEntityTypeId();
$entity_type =
$entity_type_manager->
getDefinition($entity_type_id);