class StringEqualsConcatenatedValuesConstraint

Checks a string consists of specific values found in the mapping.

Attributes

#[Constraint(id: 'StringEqualsConcatenatedValues', label: new TranslatableMarkup('String consists of specific values.', [], [ 'context' => 'Validation', ]))]

Hierarchy

Expanded class hierarchy of StringEqualsConcatenatedValuesConstraint

1 file declares its use of StringEqualsConcatenatedValuesConstraint
StringEqualsConcatenatedValuesConstraintValidatorTest.php in core/tests/Drupal/KernelTests/Core/Validation/StringEqualsConcatenatedValuesConstraintValidatorTest.php

File

core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/StringEqualsConcatenatedValuesConstraint.php, line 15

Namespace

Drupal\Core\Validation\Plugin\Validation\Constraint
View source
class StringEqualsConcatenatedValuesConstraint extends SymfonyConstraint {
  
  /**
   * Constructs a StringEqualsConcatenatedValuesConstraint object.
   *
   * @param array|null $options
   *   The options (as associative array) or the value for the default option
   *   (any other type)
   * @param string|null $separator
   *   The separator separating the values.
   * @param array|null $values
   *   The mappings to values to concatenate together.
   * @param array|null $reservedCharacters
   *   Reserved characters — if any — that are to be substituted in each value.
   * @param string|null $reservedCharactersSubstitute
   *   Any reserved characters that will be substituted by this character.
   * @param string $message
   *   The error message if the string does not match.
   * @param array|null $groups
   *   An array of validation groups.
   * @param mixed|null $payload
   *   Domain-specific data attached to a constraint.
   */
  public function __construct(?array $options = NULL, public ?string $separator = NULL, public ?array $values = NULL, public ?array $reservedCharacters = [], public ?string $reservedCharactersSubstitute = NULL, public string $message = "Expected '@expected_string', not '@value'. Format: '@expected_format'.", ?array $groups = NULL, mixed $payload = NULL) {
    parent::__construct($options, $groups, $payload);
  }
  
  /**
   * {@inheritdoc}
   */
  public function getRequiredOptions() : array {
    return [
      'separator',
      'values',
    ];
  }

}

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