Validator::clientValidateAttribute() now accepts third parameter: a view.

punycode.js asset bundle registering moved from ActiveField to validators.
This commit is contained in:
resurtm
2013-05-15 23:17:50 +06:00
parent 6458b8df8f
commit f7b8595f76
13 changed files with 45 additions and 22 deletions

View File

@@ -79,10 +79,12 @@ class RegularExpressionValidator extends Validator
* Returns the JavaScript needed for performing client-side validation.
* @param \yii\base\Model $object the data object being validated
* @param string $attribute the name of the attribute to be validated.
* @param \yii\base\View $view the view object that is going to be used to render views or view files
* containing a model form with this validator applied.
* @return string the client-side validation script.
* @throws InvalidConfigException if the "pattern" is not a valid regular expression
*/
public function clientValidateAttribute($object, $attribute)
public function clientValidateAttribute($object, $attribute, $view)
{
$pattern = $this->pattern;
$pattern = preg_replace('/\\\\x\{?([0-9a-fA-F]+)\}?/', '\u$1', $pattern);