Drupal 8  8.0.2
LazyPluginCollection Class Reference
Inheritance diagram for LazyPluginCollection:

Public Member Functions

 getConfiguration ()
 
 setConfiguration ($configuration)
 
 clear ()
 
 has ($instance_id)
 
get ($instance_id)
 
 set ($instance_id, $value)
 
 remove ($instance_id)
 
 addInstanceId ($id, $configuration=NULL)
 
 getInstanceIds ()
 
 removeInstanceId ($instance_id)
 
 getIterator ()
 
 count ()
 

Protected Member Functions

 initializePlugin ($instance_id)
 

Protected Attributes

 $pluginInstances = array()
 
 $instanceIDs = array()
 

Detailed Description

Defines an object which stores multiple plugin instances to lazy load them.

Member Function Documentation

addInstanceId (   $id,
  $configuration = NULL 
)

Adds an instance ID to the available instance IDs.

Parameters
string$idThe ID of the plugin instance to add.
array | null$configuration(optional) The configuration used by this instance. Defaults to NULL.

Referenced by LazyPluginCollection\set().

Here is the caller graph for this function:

clear ( )

Clears all instantiated plugins.

count ( )

{}

& get (   $instance_id)

Gets a plugin instance, initializing it if necessary.

Parameters
string$instance_idThe ID of the plugin instance being retrieved.

References LazyPluginCollection\initializePlugin().

Here is the call graph for this function:

getConfiguration ( )
abstract

Gets the current configuration of all plugins in this collection.

Returns
array An array of up-to-date plugin configuration.
getInstanceIds ( )

Gets all instance IDs.

Returns
array An array of all available instance IDs.

Referenced by DefaultLazyPluginCollection\setConfiguration().

Here is the caller graph for this function:

has (   $instance_id)

Determines if a plugin instance exists.

Parameters
string$instance_idThe ID of the plugin instance to check.
Returns
bool TRUE if the plugin instance exists, FALSE otherwise.
initializePlugin (   $instance_id)
abstractprotected

Initializes and stores a plugin.

Parameters
string$instance_idThe ID of the plugin instance to initialize.

Referenced by LazyPluginCollection\get().

Here is the caller graph for this function:

remove (   $instance_id)

Removes an initialized plugin.

The plugin can still be used; it will be reinitialized.

Parameters
string$instance_idThe ID of the plugin instance to remove.
removeInstanceId (   $instance_id)

Removes an instance ID.

Parameters
string$instance_idThe ID of the plugin instance to remove.
set (   $instance_id,
  $value 
)

Stores an initialized plugin.

Parameters
string$instance_idThe ID of the plugin instance being stored.
mixed$valueAn instantiated plugin.

References LazyPluginCollection\addInstanceId().

Referenced by DefaultSingleLazyPluginCollection\initializePlugin(), and DefaultLazyPluginCollection\initializePlugin().

Here is the call graph for this function:

Here is the caller graph for this function:

setConfiguration (   $configuration)
abstract

Sets the configuration for all plugins in this collection.

Parameters
array$configurationAn array of up-to-date plugin configuration.
Returns
$this

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