Pattern.php in Clientside Validation 3.0.x
File
clientside_validation_jquery/src/Plugin/CvValidator/Pattern.php
View source
<?php
namespace Drupal\clientside_validation_jquery\Plugin\CvValidator;
use Drupal\clientside_validation\CvValidatorBase;
use Drupal\Core\Form\FormStateInterface;
class Pattern extends CvValidatorBase {
protected function getRules($element, FormStateInterface $form_state) {
$message = $element['#pattern_error'] ?? $this
->t('@title does not meet the requirements.', [
'@title' => $this
->getElementTitle($element),
]);
return [
'messages' => [
'pattern' => $message,
],
];
}
}
Classes
Name |
Description |
Pattern |
Provides a 'pattern' validator. |