Mercurial > hg > cmmr2012-drupal-site
annotate vendor/chi-teck/drupal-code-generator/templates/d8/plugin/constraint.twig @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
rev | line source |
---|---|
Chris@4 | 1 <?php |
Chris@4 | 2 |
Chris@4 | 3 namespace Drupal\{{ machine_name }}\Plugin\Validation\Constraint; |
Chris@4 | 4 |
Chris@4 | 5 use Symfony\Component\Validator\Constraint; |
Chris@4 | 6 |
Chris@4 | 7 /** |
Chris@4 | 8 * Provides {{ plugin_label|article }} constraint. |
Chris@4 | 9 * |
Chris@4 | 10 * @Constraint( |
Chris@4 | 11 * id = "{{ plugin_id }}", |
Chris@4 | 12 * label = @Translation("{{ plugin_label }}", context = "Validation"), |
Chris@4 | 13 * ) |
Chris@4 | 14 {% if input_type == 'entity' %} |
Chris@4 | 15 * |
Chris@4 | 16 * @DCG |
Chris@4 | 17 * To apply this constraint on a particular field implement |
Chris@4 | 18 * hook_entity_type_build(). |
Chris@4 | 19 {% elseif input_type == 'item_list' %} |
Chris@4 | 20 * |
Chris@4 | 21 * @DCG |
Chris@4 | 22 * To apply this constraint on third party entity types implement either |
Chris@4 | 23 * hook_entity_base_field_info_alter() or hook_entity_bundle_field_info_alter(). |
Chris@4 | 24 {% elseif input_type == 'item' %} |
Chris@4 | 25 * |
Chris@4 | 26 * @DCG |
Chris@4 | 27 * To apply this constraint on third party field types. Implement |
Chris@4 | 28 * hook_field_info_alter(). |
Chris@4 | 29 {% endif %} |
Chris@4 | 30 */ |
Chris@4 | 31 class {{ class }} extends Constraint { |
Chris@4 | 32 |
Chris@4 | 33 public $errorMessage = 'The error message.'; |
Chris@4 | 34 |
Chris@4 | 35 } |