callScript()
public final function callScript($className, $scriptName [, $arg1 [, $arg2 [, ... ]]])
Lets you call JavaScript functions after your Plugin has been displayed on a page, or after your Plugin has been reloaded via AJAX.
Can be used in your plugin's init()
method, from Zenario 7.0.0 onwards.
From version 7.3 onwards, you can now use it in your showSlot() method as well.
Zenario reloads Plugins using AJAX, so you should not include any <script>
tags in your code.
If you need to include a JavaScript call when loading then you should instead call this function, which will tell the CMS to call a JavaScript function.
You may call either an API function, or one of your Plugin's custom functions created on its encapsulated object. Note that this will only call JavaScript functions that are correctly encapsulated.
$className
The class name of the Plugin that owns the script that you wish to call.
$scriptName
The name of a JavaScript function to run.
$arg1, $arg2, ...
You may pass in extra arguments. Each of these will be recorded and passed to the JavaScript function; i.e. your first extra argument will be passed to the first argument of the function you are calling, your second extra argument will be passed to the second argument of the function you are calling, and so on.
These arguments take a mixed input; you can even pass in arrays.
$this->callScript('my_plugin_class', 'myFunctionName', 'Hello World');