Skip to content
Snippets Groups Projects
Commit c5c803a9 authored by Oleksandr Pozharskyi's avatar Oleksandr Pozharskyi Committed by Viktor Holovachek
Browse files

Issue #3500204: Use attributes for MyCustomValidator plugin

parent 1ae31fa1
No related branches found
No related tags found
1 merge request!52Issue #3500204: Use attributes for MyCustomValidator plugin
Pipeline #405616 canceled
......@@ -3,19 +3,20 @@
namespace Drupal\fapiv_example\Plugin\FapiValidationValidator;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\fapi_validation\Attribute\FapiValidationValidator;
use Drupal\fapi_validation\FapiValidationValidatorsInterface;
use Drupal\fapi_validation\Validator;
/**
* Provides a custom validation.
*
* Field must have JohnDoe as value.
*
* @FapiValidationValidator(
* id = "custom_validator",
* error_callback = "processError"
* )
*/
#[FapiValidationValidator(
id: 'custom_validator',
label: new TranslatableMarkup('Custom Validator'),
description: new TranslatableMarkup('Field must have JohnDoe as value.'),
error_message: 'processError.',
)]
class MyCustomValidator implements FapiValidationValidatorsInterface {
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment