3 namespace Drupal\{{ machine_name }}\Plugin\Validation\Constraint;
5 use Symfony\Component\Validator\Constraint;
8 * Provides {{ plugin_label|article }} constraint.
11 * id = "{{ plugin_id }}",
12 * label = @Translation("{{ plugin_label }}", context = "Validation"),
14 {% if input_type == 'entity' %}
17 * To apply this constraint on a particular field implement
18 * hook_entity_type_build().
19 {% elseif input_type == 'item_list' %}
22 * To apply this constraint on third party entity types implement either
23 * hook_entity_base_field_info_alter() or hook_entity_bundle_field_info_alter().
24 {% elseif input_type == 'item' %}
27 * To apply this constraint on third party field types. Implement
28 * hook_field_info_alter().
31 class {{ class }} extends Constraint {
33 public $errorMessage = 'The error message.';