class EntityFieldUniqueValues in Helper 8
Checks if an entity field has duplicate values.
Plugin annotation
@Constraint(
id = "HelperEntityFieldUniqueValues",
label = @Translation("Unique field values", context = "Validation"),
type = {"entity"},
)
Hierarchy
- class \Drupal\helper\Plugin\Validation\Constraint\FieldListUniqueValues extends \Symfony\Component\Validator\Constraint
- class \Drupal\helper\Plugin\Validation\Constraint\EntityFieldUniqueValues
Expanded class hierarchy of EntityFieldUniqueValues
File
- src/
Plugin/ Validation/ Constraint/ EntityFieldUniqueValues.php, line 14
Namespace
Drupal\helper\Plugin\Validation\ConstraintView source
class EntityFieldUniqueValues extends FieldListUniqueValues {
/**
* The field name to validate.
*
* @var string
*/
public $field_name;
/**
* {@inheritdoc}
*/
public function getDefaultOption() {
return 'field_name';
}
/**
* {@inheritdoc}
*/
public function getRequiredOptions() {
return [
'field_name',
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityFieldUniqueValues:: |
public | property | The field name to validate. | |
EntityFieldUniqueValues:: |
public | function | Returns the name of the default option. | |
EntityFieldUniqueValues:: |
public | function | Returns the name of the required options. | |
FieldListUniqueValues:: |
public | property | Message if field contains duplicate values. | |
FieldListUniqueValues:: |
public | property | Message with values if field contains duplicate values. | |
FieldListUniqueValues:: |
public | property | The field property to use when searching for values. | |
FieldListUniqueValues:: |
public | property | If the message should show the field values that are duplicates. |