class ConfigExistsConstraint
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/ConfigExistsConstraint.php \Drupal\Core\Config\Plugin\Validation\Constraint\ConfigExistsConstraint
- 10 core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/ConfigExistsConstraint.php \Drupal\Core\Config\Plugin\Validation\Constraint\ConfigExistsConstraint
Checks that the value is the name of an existing config object.
Attributes
#[Constraint(id: 'ConfigExists', label: new TranslatableMarkup('Config exists', [], [
'context' => 'Validation',
]))]
Hierarchy
- class \Drupal\Core\Config\Plugin\Validation\Constraint\ConfigExistsConstraint extends \Symfony\Component\Validator\Constraint
Expanded class hierarchy of ConfigExistsConstraint
1 file declares its use of ConfigExistsConstraint
- ConfigExistsConstraintValidatorTest.php in core/
tests/ Drupal/ KernelTests/ Core/ Config/ ConfigExistsConstraintValidatorTest.php
File
-
core/
lib/ Drupal/ Core/ Config/ Plugin/ Validation/ Constraint/ ConfigExistsConstraint.php, line 15
Namespace
Drupal\Core\Config\Plugin\Validation\ConstraintView source
class ConfigExistsConstraint extends SymfonyConstraint {
/**
* Optional prefix, to be specified when this contains a config entity ID.
*
* Every config entity type can have multiple instances, all with unique IDs
* but the same config prefix. When config refers to a config entity,
* typically only the ID is stored, not the prefix.
*
* @var string
*/
public string $prefix = '';
public function __construct(mixed $options = NULL, ?string $prefix = NULL, public string $message = "The '@name' config does not exist.", ?array $groups = NULL, mixed $payload = NULL) {
parent::__construct($options, $groups, $payload);
$this->prefix = $prefix ?? $this->prefix;
}
}
Members
| Title Sort descending | Modifiers | Object type | Summary |
|---|---|---|---|
| ConfigExistsConstraint::$prefix | public | property | Optional prefix, to be specified when this contains a config entity ID. |
| ConfigExistsConstraint::__construct | public | function | #[HasNamedArguments] |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.