Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| RelationshipContactsConstraint | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Drupal\crm\Plugin\Validation\Constraint; |
| 4 | |
| 5 | use Drupal\Core\StringTranslation\TranslatableMarkup; |
| 6 | use Drupal\Core\Validation\Attribute\Constraint; |
| 7 | use Symfony\Component\Validator\Constraint as SymfonyConstraint; |
| 8 | |
| 9 | /** |
| 10 | * Checks that Relationship Contacts are different. |
| 11 | */ |
| 12 | #[Constraint( |
| 13 | id: 'RelationshipContacts', |
| 14 | label: new TranslatableMarkup('Relationship Contacts', [], ['context' => 'Validation']) |
| 15 | )] |
| 16 | class RelationshipContactsConstraint extends SymfonyConstraint { |
| 17 | |
| 18 | /** |
| 19 | * The message shown when the contacts are different. |
| 20 | * |
| 21 | * @var string |
| 22 | */ |
| 23 | public $differentMessage = 'Relationship Contacts must be different.'; |
| 24 | |
| 25 | /** |
| 26 | * The message shown when the contacts are of the wrong type. |
| 27 | * |
| 28 | * @var string |
| 29 | */ |
| 30 | public $wrongTypeMessage = 'Relationship Contacts must be of type @type.'; |
| 31 | |
| 32 | /** |
| 33 | * The message shown when the contact is not in the valid contacts list. |
| 34 | * |
| 35 | * @var string |
| 36 | */ |
| 37 | public $invalidContactMessage = 'The selected contact is not in the list of valid contacts for this relationship type.'; |
| 38 | |
| 39 | } |