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