You are here

class FieldListUniqueValues in Helper 8

Checks if a field has duplicate values.

Plugin annotation


@Constraint(
  id = "UniqueFieldValues",
  label = @Translation("Unique field values", context = "Validation"),
)

Hierarchy

  • class \Drupal\helper\Plugin\Validation\Constraint\FieldListUniqueValues extends \Symfony\Component\Validator\Constraint

Expanded class hierarchy of FieldListUniqueValues

File

src/Plugin/Validation/Constraint/FieldListUniqueValues.php, line 15

Namespace

Drupal\helper\Plugin\Validation\Constraint
View source
class FieldListUniqueValues extends Constraint {

  /**
   * Message if field contains duplicate values.
   *
   * @var string
   */
  public $message = 'The field %field_name contains duplicate values.';

  /**
   * Message with values if field contains duplicate values.
   *
   * @var string
   */
  public $messageWithValues = 'The field %field_name contains duplicate values: @values.';

  /**
   * The field property to use when searching for values.
   *
   * @var string
   */
  public $property = NULL;

  /**
   * If the message should show the field values that are duplicates.
   *
   * @var bool
   */
  public $show_values = TRUE;

}

Members

Namesort descending Modifiers Type Description Overrides
FieldListUniqueValues::$message public property Message if field contains duplicate values.
FieldListUniqueValues::$messageWithValues public property Message with values if field contains duplicate values.
FieldListUniqueValues::$property public property The field property to use when searching for values.
FieldListUniqueValues::$show_values public property If the message should show the field values that are duplicates.