function ConfigExistsConstraint::__construct

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/ConfigExistsConstraint.php \Drupal\Core\Config\Plugin\Validation\Constraint\ConfigExistsConstraint::__construct()

Constructs a ConfigExistsConstraint object.

Parameters

string $prefix: 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.

string $message: The error message if the config does not exist.

array|null $groups: The groups that the constraint belongs to.

mixed|null $payload: Domain-specific data attached to a constraint.

File

core/lib/Drupal/Core/Config/Plugin/Validation/Constraint/ConfigExistsConstraint.php, line 35

Class

ConfigExistsConstraint
Checks that the value is the name of an existing config object.

Namespace

Drupal\Core\Config\Plugin\Validation\Constraint

Code

public function __construct(public string $prefix = '', public string $message = "The '@name' config does not exist.", ?array $groups = NULL, mixed $payload = NULL) {
  parent::__construct(groups: $groups, payload: $payload);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.