BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
ApiModuleManager Class Reference
Inheritance diagram for ApiModuleManager:
Collaboration diagram for ApiModuleManager:

Public Member Functions

 __construct (ApiBase $parentModule)
 addModules (array $modules, $group)
 addModule ($name, $group, $class, $factory=null)
 getModule ($moduleName, $group=null, $ignoreCache=false)
 getNames ($group=null)
 getNamesWithClasses ($group=null)
 getClassName ($module)
 isDefined ($moduleName, $group=null)
 getModuleGroup ($moduleName)
 getGroups ()
- Public Member Functions inherited from ContextSource
 getContext ()
 setContext (IContextSource $context)
 getConfig ()
 getRequest ()
 getTitle ()
 canUseWikiPage ()
 getWikiPage ()
 getOutput ()
 getUser ()
 getLanguage ()
 getSkin ()
 getTiming ()
 getStats ()
 msg ()
 exportSession ()

Detailed Description

This class holds a list of modules and handles instantiation


Constructor & Destructor Documentation

ApiModuleManager::__construct ( ApiBase  $parentModule)

Construct new module manager

ApiBase$parentModuleParent module instance will be used during instantiation

Member Function Documentation

ApiModuleManager::addModule (   $name,
  $factory = null 

Add or overwrite a module in this ApiMain instance. Intended for use by extending classes who wish to add their own modules to their lexicon or override the behavior of inherent ones.

string$nameThe identifier for this module.
string$groupName of the module group
string$classThe class where this module is implemented.
callable | null$factoryCallback for instantiating the module.
ApiModuleManager::addModules ( array  $modules,

Add a list of modules to the manager. Each module is described by a module spec.

Each module spec is an associative array containing at least the 'class' key for the module's class, and optionally a 'factory' key for the factory function to use for the module.

That factory function will be called with two parameters, the parent module (an instance of ApiBase, usually ApiMain) and the name the module was registered under. The return value must be an instance of the class given in the 'class' field.

For backward compatibility, the module spec may also be a simple string containing the module's class name. In that case, the class' constructor will be called with the parent module and module name as parameters, as described above.

Examples for defining module specs:

$modules['foo'] = 'ApiFoo';
$modules['bar'] = array(
'class' => 'ApiBar',
'factory' => function( $main, $name ) { ... }
$modules['xyzzy'] = array(
'class' => 'ApiXyzzy',
'factory' => array( 'XyzzyFactory', 'newApiModule' )
array$modulesA map of ModuleName => ModuleSpec; The ModuleSpec is either a string containing the module's class name, or an associative array (see above for details).
string$groupWhich group modules belong to (action,format,...)
ApiModuleManager::getClassName (   $module)

Returns the class name of the given module

string$moduleModule name
string|bool class name or false if the module does not exist
ApiModuleManager::getGroups ( )

Get a list of groups this manager contains.

ApiModuleManager::getModule (   $moduleName,
  $group = null,
  $ignoreCache = false 

Get module instance by name, or instantiate it if it does not exist

string$moduleNameModule name
string$groupOptionally validate that the module is in a specific group
bool$ignoreCacheIf true, force-creates a new instance and does not cache it
ApiBase|null The new module instance, or null if failed
ApiModuleManager::getModuleGroup (   $moduleName)

Returns the group name for the given module

string|null Group name or null if missing
ApiModuleManager::getNames (   $group = null)

Get an array of modules in a specific group or all if no group is set.

string$groupOptional group filter
array List of module names
ApiModuleManager::getNamesWithClasses (   $group = null)

Create an array of (moduleName => moduleClass) for a specific group or for all.

string$groupName of the group to get or null for all
array Name=>class map
ApiModuleManager::isDefined (   $moduleName,
  $group = null 

Returns true if the specific module is defined at all or in a specific group.

string$moduleNameModule name
string$groupGroup name to check against, or null to check all groups,
bool True if defined

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