function ValidKeysConstraint::__construct

Attributes

#[HasNamedArguments]

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ValidKeysConstraint.php, line 32

Class

ValidKeysConstraint
Checks that all the keys of a mapping are valid and required keys present.

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint

Code

public function __construct(mixed $options = NULL, array|string|null $allowedKeys = NULL, public string $invalidKeyMessage = "'@key' is not a supported key.", public string $dynamicInvalidKeyMessage = "'@key' is an unknown key because @dynamic_type_property_path is @dynamic_type_property_value (see config schema type @resolved_dynamic_type).", public string $missingRequiredKeyMessage = "'@key' is a required key.", public string $dynamicMissingRequiredKeyMessage = "'@key' is a required key because @dynamic_type_property_path is @dynamic_type_property_value (see config schema type @resolved_dynamic_type).", public string $indexedArrayMessage = 'Numerically indexed arrays are not allowed.', ?array $groups = NULL, mixed $payload = NULL) {
  parent::__construct($options, $groups, $payload);
  $this->allowedKeys = $allowedKeys ?? $this->allowedKeys;
}

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