Min.php in Clientside Validation 2.0.x
File
src/Plugin/CvValidator/Min.php
View source
<?php
namespace Drupal\clientside_validation\Plugin\CvValidator;
use Drupal\clientside_validation\CvValidatorBase;
use Drupal\Core\Form\FormStateInterface;
class Min extends CvValidatorBase {
protected function getRules($element, FormStateInterface $form_state) {
$message = $element['#min_error'] ?? $this
->t('The value in @title has to be greater than @min.', [
'@title' => $this
->getElementTitle($element),
'@min' => $this
->getAttributeValue($element, 'min'),
]);
return [
'messages' => [
'min' => $message,
],
];
}
}
Classes
Name |
Description |
Min |
Provides a 'min' validator. |