This EM is a replacement for Go-Prod plugin.
Yes, This Module allows developer to add new custom rules.
- Create a Rule class under Rules folder
- The new class MUST implement interface
ValidationsImplementation
. (Classes not implementing the interface will be ignored by the EM). - Define your rule notifications in Language folder
- Class name must be in
snake_case
format. - The class must has the following methods (You can more methods if needed):
getProject
setProject
validate
getErrorMessage
getNotifications
setNotifications
- Please Note you do not have to call
setProject
andsetNotifications
as they are called by default when rule is enabled. validate
method will contain the validation logic. The method will returntrue
if validation passed.false
if validation failed.- If validation failed method
getErrorMessage
will be called. which will return an array with following parameter.title
will be pulled from notification.ini file.body
will be pulled from notification.ini file.type
can be one of following: DANGER, WARNING, INFO.modal
If you want user to open a modal this will be an array of modal table rows.modalHeader
modal table header.extra
custom text or html to be displayed.links
array of links.
- When your class is ready you need to tell the EM about it in
config.json
.- Add a new checkbox to enable/disable the rule under system settings section.
{ "key": "[YOUR_RULE_CLASSNAME]", <-- THIS MUST MATCH YOUR RULE CLASSNAME. "name": "[DESCRIBTION ABOUT YOUR RULE]", "required": false, "type": "checkbox" }
- add
[YOUR_RULE_CLASSNAME]
underauth-ajax-actions
.
- Add a new checkbox to enable/disable the rule under system settings section.
Here is a new rule class example: link