joomla/joomla-cms — pull request #5277 by roland-d (2014-12-01 21:48:15+00:00)
Title: JFormValidator to pass element to handler updated

Original by @itbra :

I found the form validator to process the passed value only making it hard to implement custom validation rules. I am using form field types that make use of additional data-attributes. These attributes may serve information required to implement a custom validation rule. For instance to validate a date field (filled by a datepicker) the validator not only needs the value, but also a rule (date format) to validate against. This rule may be geographically different and a data-attribute like data-format="YY/MM/DD"may allow to validate the selected date against this rule. When it was possible to pass the element being validated along with the value to be checked the handler may fetch the required date format from the data-format attribute and apply it.
I did not touch the existing handlers' signature since they must not explicitely changed. The passed in element may be accessible via the implicitly accessable arguments object. But, if it is wished to add them a second function parameter for the element i can change it.

This PR implements a very tiny change providing more validation flexibility.

(I am just helping with the PR)