forked from ProcessMaker/processmaker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModelerManager.php
More file actions
63 lines (57 loc) · 2.09 KB
/
ModelerManager.php
File metadata and controls
63 lines (57 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace ProcessMaker\Managers;
class ModelerManager
{
private $javascriptRegistry;
private $javascriptParamsRegistry;
/**
* Start our modeler manager, registering our initial javascript
* which will add our intial node types to the modeler (base bpmn types/shapes)
*/
public function __construct()
{
$this->javascriptRegistry = [];
// Include our default javascript for our core controls
$this->addScript(mix('js/processes/modeler/initialLoad.js'));
}
/**
* Add a script to the JavaScript registry with optional parameters.
*
* This method adds a script to the JavaScript registry along with optional parameters.
* The script URL is added to the registry, and if additional parameters are provided,
* they are merged with the default parameters.
*
* @param string $script The URL of the script to add to the registry.
* @param array $params Additional parameters for configuring the script (optional).
* @return void
*/
public function addScript($script, array $params = [])
{
// Add the script URL to the JavaScript registry
$this->javascriptRegistry[] = $script;
// Merge additional parameters with the default parameters and add to the parameters registry
$this->javascriptParamsRegistry[] = array_merge(['src' => $script], $params);
}
/**
* Retrieve the list of scripts that have been added. This is used in the modeler blade
* to execute each script in a script tag before the modeler is started.
*
* @return array Collection of paths to scripts to load
*/
public function getScripts()
{
return $this->javascriptRegistry;
}
/**
* Retrieve the JavaScript parameters registry.
*
* This method returns the JavaScript parameters registry, which contains
* parameters used to configure scripts in the application.
*
* @return array The JavaScript parameters registry.
*/
public function getScriptWithParams()
{
return $this->javascriptParamsRegistry;
}
}