yii\validators\CompareValidator::clientValidateAttribute PHP Метод

clientValidateAttribute() публичный Метод

public clientValidateAttribute ( $model, $attribute, $view )
    public function clientValidateAttribute($model, $attribute, $view)
    {
        $options = ['operator' => $this->operator, 'type' => $this->type];
        if ($this->compareValue !== null) {
            $options['compareValue'] = $this->compareValue;
            $compareLabel = $compareValue = $compareValueOrAttribute = $this->compareValue;
        } else {
            $compareAttribute = $this->compareAttribute === null ? $attribute . '_repeat' : $this->compareAttribute;
            $compareValue = $model->getAttributeLabel($compareAttribute);
            $options['compareAttribute'] = Html::getInputId($model, $compareAttribute);
            $compareLabel = $compareValueOrAttribute = $model->getAttributeLabel($compareAttribute);
        }
        if ($this->skipOnEmpty) {
            $options['skipOnEmpty'] = 1;
        }
        $options['message'] = Yii::$app->getI18n()->format($this->message, ['attribute' => $model->getAttributeLabel($attribute), 'compareAttribute' => $compareLabel, 'compareValue' => $compareValue, 'compareValueOrAttribute' => $compareValueOrAttribute], Yii::$app->language);
        ValidationAsset::register($view);
        return 'yii.validation.compare(value, messages, ' . json_encode($options, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ');';
    }