/** * @inheritdoc */ public function clientValidateAttribute($model, $attribute, $view) { $pattern = Html::escapeJsRegularExpression($this->pattern); $options = ['pattern' => new JsExpression($pattern), 'not' => $this->not, 'message' => Leaps::$app->getI18n()->format($this->message, ['attribute' => $model->getAttributeLabel($attribute)], Leaps::$app->language)]; if ($this->skipOnEmpty) { $options['skipOnEmpty'] = 1; } ValidationAsset::register($view); return 'leaps.validation.regularExpression(value, messages, ' . Json::htmlEncode($options) . ');'; }