You are here

UniqueFieldConstraint.php in Unique field 8

File

src/Plugin/Validation/Constraint/UniqueFieldConstraint.php
View source
<?php

/**
 * @file
 * Contains \Drupal\unique_field\Plugin\Validation\Constraint\UniqueFieldConstraint.
 */
namespace Drupal\unique_field\Plugin\Validation\Constraint;

use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\MissingOptionsException;

/**
 * Checks whether the field has unique values.
 *
 * @Plugin(
 *   id = "UniqueField",
 *   label = @Translation("Unique field", context = "Validation"),
 * )
 */
class UniqueFieldConstraint extends Constraint {
  public $bundle;
  public $scope;
  public $match;
  public $comb;
  public $fields;
  public $matches = 'Matches are found in the following content: !node';
  public $UniqueMessage = 'Field %label should be unique. %value is already used';
  public function __construct($options = null) {
    parent::__construct($options);
  }

}

Classes

Namesort descending Description
UniqueFieldConstraint Checks whether the field has unique values.