function ContextDefinition::__construct
Same name in this branch
- 8.x-3.x src/Context/ContextDefinition.php \Drupal\rules\Context\ContextDefinition::__construct()
Constructs a new context definition object.
Parameters
array $values: An associative array with the following keys:
- value: The required data type.
- label: (optional) The UI label of this context definition.
- required: (optional) Whether the context definition is required.
- multiple: (optional) Whether the context definition is multivalue.
- description: (optional) The UI description of this context definition.
- default_value: (optional) The default value in case the underlying value is not set.
- class: (optional) A custom ContextDefinitionInterface class.
Overrides ContextDefinition::__construct
File
-
src/
Context/ Annotation/ ContextDefinition.php, line 31
Class
- ContextDefinition
- Extends the core context definition annotation object for Rules.
Namespace
Drupal\rules\Context\AnnotationCode
public function __construct(array $values) {
// Filter out any @Translation annotation objects.
foreach ($values as $key => $value) {
if ($value instanceof Translation) {
$values[$key] = $value->get();
}
}
$this->definition = RulesContextDefinition::createFromArray($values);
}