Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
MatchWithValidator.php
Go to the documentation of this file.
1<?php
2
4
6
17 protected $field;
18 public static ?array $values;
19
20 public function __construct() {
21 $this->message = 'This value should be equals to `{field}` content.';
22 }
23
24 public function validate($value) {
25 parent::validate ( $value );
26 $values = self::$values ?? $_POST;
27 if ($this->notNull !== false) {
28 return $value == $values [$this->field] ?? null;
29 }
30 return true;
31 }
32
38 public function getParameters(): array {
39 return [ 'field','value' ];
40 }
41
47 public function asUI(): array {
48 return \array_merge_recursive ( parent::asUI (), [ 'rules' => [ [ 'type' => 'match','prompt' => $this->_getMessage (),'value' => $this->field ] ] ] );
49 }
50}
51
Ubiquity\contents\validation\validators\comparison$MatchWithValidator This class is part of Ubiquity.
getParameters()
{{}\Ubiquity\contents\validation\validators\ValidatorInterfacegetParameters()}