Bug: global editor.validator($afterFields, function(...)) does not work when called with 'false'
Bug: global editor.validator($afterFields, function(...)) does not work when called with 'false'
Relates to Editor 2.4.3
2 problems:
1 - There seems to be no default value false (as mentioned in the doc) for $afterFields
public function validator($afterFields, $_ = null)
should it not be:
public function validator($afterFields = false, $_ = null)
2 - when $afterFields is set to false (evaluate before fields), $_ is set to false with the following line:
// Argument shift
$_ = $afterFields;
which in turn makes the function always return false, rather than $this (see _getSet in Ext.php)
Workaround:
remove the lines:
// Argument shift
$_ = $afterFields;
and the validator works.
Regards
Mark
Replies
Like this also works, and does not involve setting the default of $afterFields, which is taken care of by the Argument shift in case it is a callable:
Hi Mark,
Thanks for the feedback on this.
1) should it not be: [...]
I don't think it should - the idea is that
Editor->validator()
should effectively allow an overload:2) which in turn makes the function always return false
Good point! It doesn't correctly handle
false
being passed in as the first argument. I normally try to do any argument shifting at the top of the function to avoid tying myself in knots, and for whatever reason I didn't there. I've reworked it now to address this.Thanks again!
Allan
Great
Thanks
Mark