I would like to understand how to add additional data to custom validation rule. I noticed in Magento 2 core files something like the following:
validator.addRule(
'validate-customer-company',
function (value, params, data) {
return !(data.customer && data['is_company_user']
},
$.mage.__('Message')
...
Does anyone know where data parameter comes from? In my case value comes from input field, params is true and data is undefined. And the validation is added to company_form.xml like this:
<field name="fieldName">
...
<settings>
<validation>
<rule name="custom_rule" xsi:type="boolean">true</rule>
</validation>
</settings>
Thanks!