13 private $baseUrl =
'';
14 private $paths = array();
15 private $shim = array();
16 private $dependencies = array();
29 $this->hooks = $hooks;
39 $this->baseUrl =
$url;
51 if (preg_match(
"/\.js$/",
$path)) {
55 if (!isset($this->paths[
$name])) {
56 $this->paths[
$name] = array();
59 array_unshift($this->paths[$name],
$path);
71 unset($this->paths[
$name]);
73 if (preg_match(
"/\.js$/",
$path)) {
78 unset($this->paths[$name][
$key]);
80 if (empty($this->paths[$name])) {
81 unset($this->paths[$name]);
99 if (empty(
$deps) && empty($exports)) {
100 throw new \InvalidParameterException(
"Shimmed modules must have deps or exports");
103 $this->shim[
$name] = array();
109 if (!empty($exports)) {
110 $this->shim[
$name][
'exports'] = $exports;
121 return isset($this->shim[
$name]);
131 unset($this->shim[
$name]);
141 $this->dependencies[
$name] =
true;
151 unset($this->dependencies[
$name]);
160 return array_keys($this->dependencies);
170 return isset($this->dependencies[
$name]);
196 if (!empty(
$deps) || !empty($exports)) {
226 if (isset($this->shim[
$name])) {
230 if (isset($this->paths[$name])) {
244 'baseUrl' => $this->baseUrl,
245 'paths' => $this->paths,
246 'shim' => $this->shim,
removeShim($name)
Unregister the shim config for a module.
addDependency($name)
Add a dependency.
if($guid==elgg_get_logged_in_user_guid()) $name
addModule($name, array $config=array())
Adds a standard AMD or shimmed module to the config.
__construct(\Elgg\PluginHooksService $hooks)
Constructor.
addPath($name, $path)
Add a path mapping for a module.
setBaseUrl($url)
Set the base URL for the site.
removePath($name, $path=null)
Remove a path for a module.
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
getDependencies()
Get registered dependencies.
addShim($name, array $config)
Configures a shimmed module.
getConfig()
Get the configuration of AMD.
hasShim($name)
Is this shim defined.
hasModule($name)
Is module configured?
hasDependency($name)
Is this dependency registered.
removeModule($name)
Removes all config for a module.
removeDependency($name)
Removes a dependency.