function EntityContextDefinition::__construct
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::__construct()
- 8.9.x core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::__construct()
- 10 core/lib/Drupal/Core/Plugin/Context/EntityContextDefinition.php \Drupal\Core\Plugin\Context\EntityContextDefinition::__construct()
Overrides ContextDefinition::__construct
File
-
core/
lib/ Drupal/ Core/ Plugin/ Context/ EntityContextDefinition.php, line 20
Class
- EntityContextDefinition
- Defines a class to provide entity context definitions.
Namespace
Drupal\Core\Plugin\ContextCode
public function __construct($data_type = 'any', $label = NULL, $required = TRUE, $multiple = FALSE, $description = NULL, $default_value = NULL, array $constraints = []) {
// Prefix the data type with 'entity:' so that this class can be constructed
// like so: new EntityContextDefinition('node')
if (!str_starts_with($data_type, 'entity:')) {
$data_type = "entity:{$data_type}";
}
parent::__construct($data_type, $label, $required, $multiple, $description, $default_value, $constraints);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.