Elgg  Version master
Public Member Functions | List of all members
Elgg\Amd\Config Class Reference

Control configuration of RequireJS. More...

Public Member Functions

 __construct (\Elgg\PluginHooksService $hooks)
 Constructor. More...
 
 setBaseUrl ($url)
 Set the base URL for the site. More...
 
 addPath (string $name, string $path)
 Add a path mapping for a module. More...
 
 removePath ($name, $path=null)
 Remove a path for a module. More...
 
 addShim (string $name, array $config)
 Configures a shimmed module. More...
 
 hasShim ($name)
 Is this shim defined. More...
 
 removeShim ($name)
 Unregister the shim config for a module. More...
 
 addDependency (string $name)
 Add a dependency. More...
 
 removeDependency (string $name)
 Removes a dependency. More...
 
 getDependencies ()
 Get registered dependencies. More...
 
 hasDependency ($name)
 Is this dependency registered. More...
 
 addModule ($name, array $config=[])
 Adds a standard AMD or shimmed module to the config. More...
 
 removeModule ($name)
 Removes all config for a module. More...
 
 hasModule ($name)
 Is module configured? More...
 
 getConfig ()
 Get the configuration of AMD. More...
 

Detailed Description

Control configuration of RequireJS.

Definition at line 12 of file Config.php.

Constructor & Destructor Documentation

Elgg\Amd\Config::__construct ( \Elgg\PluginHooksService  $hooks)

Constructor.

Parameters
\Elgg\PluginHooksService$hooksThe hooks service

Definition at line 28 of file Config.php.

Member Function Documentation

Elgg\Amd\Config::addDependency ( string  $name)

Add a dependency.

Parameters
string$nameName of the dependency
Returns
void

Definition at line 144 of file Config.php.

Elgg\Amd\Config::addModule (   $name,
array  $config = [] 
)

Adds a standard AMD or shimmed module to the config.

Parameters
string$nameThe name of the module
array$configConfiguration for the module
  • url: string The full URL for the module if not resolvable from baseUrl
  • deps: array Shimmed module's dependencies
  • exports: string Name of the shimmed module to export
Returns
void

Definition at line 189 of file Config.php.

Elgg\Amd\Config::addPath ( string  $name,
string  $path 
)

Add a path mapping for a module.

If a path is already defined, sets current path as preferred.

Parameters
string$nameModule name
string$pathFull URL of the module
Returns
void

Definition at line 51 of file Config.php.

Elgg\Amd\Config::addShim ( string  $name,
array  $config 
)

Configures a shimmed module.

Parameters
string$nameModule name
array$configConfiguration for the module
  • deps: array Dependencies
  • exports: string Name of the shimmed module to export
Returns
void
Exceptions
InvalidParameterException

Definition at line 98 of file Config.php.

Elgg\Amd\Config::getConfig ( )

Get the configuration of AMD.

Returns
array

Definition at line 247 of file Config.php.

Elgg\Amd\Config::getDependencies ( )

Get registered dependencies.

Returns
array

Definition at line 164 of file Config.php.

Elgg\Amd\Config::hasDependency (   $name)

Is this dependency registered.

Parameters
string$nameModule name
Returns
bool

Definition at line 174 of file Config.php.

Elgg\Amd\Config::hasModule (   $name)

Is module configured?

Parameters
string$nameModule name
Returns
boolean

Definition at line 226 of file Config.php.

Elgg\Amd\Config::hasShim (   $name)

Is this shim defined.

Parameters
string$nameThe name of the shim
Returns
bool

Definition at line 123 of file Config.php.

Elgg\Amd\Config::removeDependency ( string  $name)

Removes a dependency.

Parameters
string$nameName of the dependency
Returns
void

Definition at line 155 of file Config.php.

Elgg\Amd\Config::removeModule (   $name)

Removes all config for a module.

Parameters
string$nameThe module name
Returns
bool

Definition at line 214 of file Config.php.

Elgg\Amd\Config::removePath (   $name,
  $path = null 
)

Remove a path for a module.

Parameters
string$nameModule name
mixed$pathThe path to remove. If null, removes all paths (default).
Returns
void

Definition at line 70 of file Config.php.

Elgg\Amd\Config::removeShim (   $name)

Unregister the shim config for a module.

Parameters
string$nameModule name
Returns
void

Definition at line 133 of file Config.php.

Elgg\Amd\Config::setBaseUrl (   $url)

Set the base URL for the site.

Parameters
string$urlURL
Returns
void

Definition at line 38 of file Config.php.


The documentation for this class was generated from the following file: