Class Manager
Central plugin interface that loads plugins, managed zones and invokes callbacks on registered plugins.
Initialisation
A plugin manager should be registered with the central registry using the
Core\Registry::DefaultPluginManager key. Afterwards, the application
should retrieve a list of active plugin names (e.g. from the configuration)
and call Core\Plugin\Manager::load()
for each plugin; the plugin is loaded and provides
a list of plugin zones for which the plugin is registered.
Plugin Invocation
Once the plugin manager is set up and all plugins are loaded, the application
can call the Core\Plugin\Manager::invoke()
method, based on a zone and callback name, to
invoke the callback of every plugin that has registered itself for the
corresponding zone and callback name.
- Core\Object implements Core\Chainable
- Core\Set implements Core\Accessor
- Core\Plugin\Manager
Package: Core\Plugin
Since: 3.1
Requires: PHP 5.3
Version: 1.0
Located at Plugin/Manager.inc.php
Methods summary
public
|
#
load( string $moduleName )
Loads and initialises a plugin. The plugin is identified via the given module name. If a corresponding plugin class is exists after successful module load, an instance is created and the plugin is assigned to each zone from the list of zones that the plugin provides. Zones are initialised as required. |
public
mixed
|
#
invoke( string $zoneName, string $callbackName, array $arguments = null, callable $invocationCallback = null )
Invokes a callback on all plugins registered for the given zone and callback name. |
public
|
#
zone( string $zoneName )
Returns a zone instance by name. If the zone does not yet exist, a new zone instance is automatically created and assigned to the manager. |
Methods inherited from Core\Object
__autocreateFactory()
,
__call()
,
__processParameters()
,
__toString()
,
attachMethod()
,
chain()
,
getValueForKey()
,
getValueForKeyPath()
,
getValueForUndefinedKey()
,
hash()
,
issetValueForKey()
,
setValueForKey()
,
setValueForKeyPath()
,
setValueForUndefinedKey()
,
uuid()
Constants summary
Constants inherited from Core\Object
AnyParameterType
,
AutochainParameterType
,
AutocreateParameterType
,
BooleanParameterType
,
CharParameterType
,
EnumParameterType
,
IntegerParameterType
,
RealParameterType
,
StringParameterType
,
UserParameterType
Properties summary
protected
|
$_v_plugins
Associative array of plugin module names and their respective instances. |
|
protected
|
$_v_zones
Associative array of zone names and their respective instances. |