31,024
edits
Tag: 2017 source edit |
Tag: 2017 source edit |
||
| Line 118: | Line 118: | ||
To add context information (for example to dissociate 2 different cases called with the same Trigger code), it is possible to place this information in the properties ->context of the object on which the trigger is called. Example: | To add context information (for example to dissociate 2 different cases called with the same Trigger code), it is possible to place this information in the properties ->context of the object on which the trigger is called. Example: | ||
<syntaxHighlight lang="php"> | |||
// Call trigger | // Call trigger | ||
$this->context = array('paramX'=>$valueX, 'anyparamofyourchoice'=>$anyvalue); | $this->context = array('paramX'=>$valueX, 'anyparamofyourchoice'=>$anyvalue); | ||
| Line 123: | Line 125: | ||
if ($result < 0) $error++; | if ($result < 0) $error++; | ||
// End call triggers | // End call triggers | ||
</syntaxHighlight> | |||
It will then be possible to add in the run_trigger method of any trigger file, an if which allows you to manage this code. The run_trigger method would then be of the form: | It will then be possible to add in the run_trigger method of any trigger file, an if which allows you to manage this code. The run_trigger method would then be of the form: | ||