Habari\FormValidators::validate_same PHP Метод

validate_same() публичный статический Метод

A validation function that returns an error if the passed control values do not match
public static validate_same ( $value, FormControl $control, FormContainer $form, FormControl $matcher, string $warning = null ) : array
$control FormControl The control that defines the value
$form FormContainer The container that holds the control
$matcher FormControl The control which should have a matching value
$warning string An optional error message
Результат array An empty array if the value exists, or an array with strings describing the errors
    public static function validate_same($value, $control, $form, $matcher, $warning = null)
    {
        if ($value != $matcher->value) {
            $warning = empty($warning) ? _t('The value of the %1$s field must match the value of %2$s.', array($control->get_label(), $matcher->get_label())) : $warning;
            return array($warning);
        }
        return array();
    }