12 private $baseUrl =
'';
13 private $paths = array();
14 private $shim = array();
15 private $dependencies = array();
24 $this->baseUrl =
$url;
36 if (preg_match(
"/\.js$/",
$path)) {
40 if (!isset($this->paths[
$name])) {
41 $this->paths[
$name] = array();
44 array_unshift($this->paths[$name],
$path);
56 unset($this->paths[
$name]);
60 unset($this->paths[$name][
$key]);
76 if (empty(
$deps) && empty($exports)) {
80 $this->shim[
$name] = array();
86 if (!empty($exports)) {
87 $this->shim[
$name][
'exports'] = $exports;
98 return isset($this->shim[
$name]);
108 unset($this->shim[
$name]);
118 $this->dependencies[
$name] =
true;
128 unset($this->dependencies[
$name]);
137 return array_keys($this->dependencies);
147 return isset($this->dependencies[
$name]);
173 if (!empty(
$deps) || !empty($exports)) {
203 if (isset($this->shims[
$name])) {
207 if (isset($this->paths[$name])) {
221 'baseUrl' => $this->baseUrl,
222 'paths' => $this->paths,
223 'shim' => $this->shim,
hasDependency($name)
Is this dependency registered.
addDependency($name)
Add a dependency.
hasShim($name)
Is this shim defined.
if($guid==elgg_get_logged_in_user_guid()) $name
addPath($name, $path)
Add a path mapping for a module.
removeShim($name)
Unregister the shim config 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.
removeDependency($name)
Removes a dependency.
hasModule($name)
Is module configured?
addShim($name, array $config)
Configures a shimmed module.
getConfig()
Get the configuration of AMD.
addModule($name, array $config=array())
Adds a standard AMD or shimmed module to the config.
removePath($name, $path=null)
Remove a path for a module.
getDependencies()
Get registered dependencies.
removeModule($name)
Removes all config for a module.
setBaseUrl($url)
Set the base URL for the site.