UniqueLabelInListConstraint.php

Same filename and directory in other branches
  1. 11.x core/modules/ckeditor5/src/Plugin/Validation/Constraint/UniqueLabelInListConstraint.php
  2. 10 core/modules/ckeditor5/src/Plugin/Validation/Constraint/UniqueLabelInListConstraint.php
  3. 9 core/modules/ckeditor5/src/Plugin/Validation/Constraint/UniqueLabelInListConstraint.php

Namespace

Drupal\ckeditor5\Plugin\Validation\Constraint

File

core/modules/ckeditor5/src/Plugin/Validation/Constraint/UniqueLabelInListConstraint.php

View source
<?php

declare (strict_types=1);
namespace Drupal\ckeditor5\Plugin\Validation\Constraint;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Validation\Attribute\Constraint;
use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint as SymfonyConstraint;

/**
 * Uniquely labeled list item constraint.
 *
 * @internal
 */
class UniqueLabelInListConstraint extends SymfonyConstraint {
  
  /**
   * The key of the label that this validation constraint should check.
   *
   * @var null|string
   */
  public $labelKey = NULL;
  public function __construct(mixed $options = NULL, ?string $labelKey = NULL, public $message = 'The label %label is not unique.', ?array $groups = NULL, mixed $payload = NULL) {
    parent::__construct($options, $groups, $payload);
    $this->labelKey = $labelKey ?? $this->labelKey;
  }
  
  /**
   * {@inheritdoc}
   */
  public function getRequiredOptions() : array {
    return [
      'labelKey',
    ];
  }

}

Classes

Title Deprecated Summary
UniqueLabelInListConstraint Uniquely labeled list item constraint.

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