13 private $baseUrl =
'';
14 private $paths = array();
15 private $shim = array();
16 private $dependencies = array();
25 $this->baseUrl =
$url;
37 if (preg_match(
"/\.js$/",
$path)) {
41 if (!isset($this->paths[
$name])) {
42 $this->paths[
$name] = array();
45 array_unshift($this->paths[$name],
$path);
57 unset($this->paths[
$name]);
59 if (preg_match(
"/\.js$/",
$path)) {
64 unset($this->paths[$name][
$key]);
66 if (empty($this->paths[$name])) {
67 unset($this->paths[$name]);
85 if (empty(
$deps) && empty($exports)) {
86 throw new \InvalidParameterException(
"Shimmed modules must have deps or exports");
89 $this->shim[
$name] = array();
95 if (!empty($exports)) {
96 $this->shim[
$name][
'exports'] = $exports;
107 return isset($this->shim[
$name]);
117 unset($this->shim[
$name]);
127 $this->dependencies[
$name] =
true;
137 unset($this->dependencies[
$name]);
146 return array_keys($this->dependencies);
156 return isset($this->dependencies[
$name]);
182 if (!empty(
$deps) || !empty($exports)) {
212 if (isset($this->shim[
$name])) {
216 if (isset($this->paths[$name])) {
230 'baseUrl' => $this->baseUrl,
231 'paths' => $this->paths,
232 '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.
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.