Your cart is empty!
Load Rules
public function onLoadCustomFieldsRules( array &$rules ) : void
Fires while loading the list of supported custom fields rules.
Description
Trigger hook to allow external plugins to support additional rules for the custom fields.
New rules have to be appended to the given associative array. The key of the array is the unique ID of the rule, the value is a readable name of the rule.
All the values included within the $rules array will be reported as accepted options of the Rule dropdown under the management page of a custom field.
Parameters
- &$rules
-
(array) An associative array holding all the supported rules.
Return Value
None.
Example
The example below adds support for a new rule that extracts the country code from the field.
/**
* Trigger hook to allow external plugins to support custom rules.
* New rules have to be appended to the given associative array.
* The key of the array is the unique ID of the rule, the value is
* a readable name of the rule.
*
* @param array &$rules An array of rules.
*
* @return void
*/
public function onLoadCustomFieldsRules(&$rules)
{
// add support for a new "country" rule
$rules['country'] = 'Country';
}
Changelog
Version | Description |
---|---|
1.9 | Introduced. |
Last Update: 2023-12-29 14:15
Helpful?