Skip to content
Snippets Groups Projects

Issue #3500204: Use attributes for MyCustomValidator plugin

Merged Issue #3500204: Use attributes for MyCustomValidator plugin
1 unresolved thread
1 unresolved thread
1 file
+ 8
7
Compare changes
  • Side-by-side
  • Inline
@@ -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.',
Please register or sign in to reply
)]
class MyCustomValidator implements FapiValidationValidatorsInterface {
/**
Loading