HOW TO define triggers for module settings?

Discuss everything related to ApPHP Durecty CMF. All versions. Any questions related to the Directy CMF developing or using should be posted to this forum.

Moderators: alexandrleonenko, alexmst

administrator
Site Admin
Site Admin
Posts: 6057
Joined: Jan 7th, '09, 23:18
Contact:

HOW TO define triggers for module settings?

Postby administrator » Dec 16th, '17, 17:01

Sometimes, when you create new property for modules, you have to define it to be related to some conditions.
Directy CMF has special option to do this.

There is a special field in "module_settings" table, that called "trigger_condition".
This field includes serialized array of trigger condition and data.

Below and example of such trigger:

Code: Select all

$serialize_data =  serialize(array(
   'trigger'=>array('key'=>'send_admin_email_notification', 'operation'=>'!=', 'value'=>'0'),
   'action'=>array('field'=>'is_required', 'value'=>'1')
));


After serialization such data will be looking as:

Code: Select all

a:2:{s:7:"trigger";a:3:{s:3:"key";s:29:"send_admin_email_notification";s:9:"operation";s:2:"!=";s:5:"value";s:1:"0";}s:6:"action";a:2:{s:5:"field";s:11:"is_required";s:5:"value";s:1:"1";}}


Store this data into "trigger_condition" and it will be used automatically by the system.

Return to “ApPHP Directy CMF {developers/users}”