Mercurial > hg > cmmr2012-drupal-site
diff vendor/chi-teck/drupal-code-generator/templates/d8/plugin/constraint.twig @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vendor/chi-teck/drupal-code-generator/templates/d8/plugin/constraint.twig Thu Feb 28 13:11:55 2019 +0000 @@ -0,0 +1,35 @@ +<?php + +namespace Drupal\{{ machine_name }}\Plugin\Validation\Constraint; + +use Symfony\Component\Validator\Constraint; + +/** + * Provides {{ plugin_label|article }} constraint. + * + * @Constraint( + * id = "{{ plugin_id }}", + * label = @Translation("{{ plugin_label }}", context = "Validation"), + * ) +{% if input_type == 'entity' %} + * + * @DCG + * To apply this constraint on a particular field implement + * hook_entity_type_build(). +{% elseif input_type == 'item_list' %} + * + * @DCG + * To apply this constraint on third party entity types implement either + * hook_entity_base_field_info_alter() or hook_entity_bundle_field_info_alter(). +{% elseif input_type == 'item' %} + * + * @DCG + * To apply this constraint on third party field types. Implement + * hook_field_info_alter(). +{% endif %} + */ +class {{ class }} extends Constraint { + + public $errorMessage = 'The error message.'; + +}