public function Context::addCondition in Context 8
Same name and namespace in other branches
- 8.4 src/Entity/Context.php \Drupal\context\Entity\Context::addCondition()
- 8.0 src/Entity/Context.php \Drupal\context\Entity\Context::addCondition()
Set the conditions.
Parameters
array $configuration: The configuration for the condition plugin.
Return value
string
Overrides ContextInterface::addCondition
File
- src/
Entity/ Context.php, line 272
Class
- Context
- Defines the Context entity.
Namespace
Drupal\context\EntityCode
public function addCondition(array $configuration) {
// Add an UUID to the condition to make sure the configuration is saved
// since the configuration export from the conditions collection wont
// export configuration that has not been "configured".
$configuration['uuid'] = $this
->uuidGenerator()
->generate();
$this
->getConditions()
->addInstanceId($configuration['id'], $configuration);
return $configuration['id'];
}