ExpressionManagerStart
From LimeSurvey Manual
Usage
This event is triggered when the Expression Script engine builds its list of available functions. It allows a plugin to register its own custom Expression Manager function(s).
Input
None.
Possible output
- functions: array of new functions to add to the expression manager.
- packages: array of name => definition pairs, registered via Yii's CClientScript package mechanism, added as a dependency of the expression manager's own JavaScript package.
Function definition
Each function is defined as a zero-indexed array containing, in order:
- PHP callable to execute — can use a fully qualified class name, e.g.
\Namespace\Class::method. - JavaScript function name, or
nullfor a static function (one with no live JavaScript evaluation). - Short description, shown in the administration GUI.
- Usage syntax, shown in the administration GUI.
- Help URL.
- Number of arguments — trailing elements of the array give the allowed argument count(s):
1, 2: 1 or 2 arguments1, 2, 3, 4: 1, 2, 3 or 4 arguments2, 4: 2 or 4 arguments- A negative value means "at least N arguments, any number above that":
-1means any number of arguments (minimum 0),-2means at least 1 argument,-3means at least 2, and so on (minimum = abs(value + 1)). Only the first value is used in this case — no other trailing elements are read.