public function ContextDefinition::__construct in Drupal 9
Same name in this branch
- 9 core/lib/Drupal/Core/Annotation/ContextDefinition.php \Drupal\Core\Annotation\ContextDefinition::__construct()
- 9 core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::__construct()
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Plugin/Context/ContextDefinition.php \Drupal\Core\Plugin\Context\ContextDefinition::__construct()
Constructs a new context definition object.
Parameters
string $data_type: The required data type.
string|null $label: The label of this context definition for the UI.
bool $required: Whether the context definition is required.
bool $multiple: Whether the context definition is multivalue.
string|null $description: The description of this context definition for the UI.
mixed $default_value: The default value of this definition.
1 call to ContextDefinition::__construct()
- EntityContextDefinition::__construct in core/
lib/ Drupal/ Core/ Plugin/ Context/ EntityContextDefinition.php - Constructs a new context definition object.
1 method overrides ContextDefinition::__construct()
- EntityContextDefinition::__construct in core/
lib/ Drupal/ Core/ Plugin/ Context/ EntityContextDefinition.php - Constructs a new context definition object.
File
- core/
lib/ Drupal/ Core/ Plugin/ Context/ ContextDefinition.php, line 107
Class
- ContextDefinition
- Defines a class for context definitions.
Namespace
Drupal\Core\Plugin\ContextCode
public function __construct($data_type = 'any', $label = NULL, $required = TRUE, $multiple = FALSE, $description = NULL, $default_value = NULL) {
$this->dataType = $data_type;
$this->label = $label;
$this->isRequired = $required;
$this->isMultiple = $multiple;
$this->description = $description;
$this->defaultValue = $default_value;
assert(strpos($data_type, 'entity:') !== 0 || $this instanceof EntityContextDefinition);
}