Drupal 8  8.0.2
DefaultPluginManager Class Reference
Inheritance diagram for DefaultPluginManager:

Public Member Functions

 __construct ($subdir,\Traversable $namespaces, ModuleHandlerInterface $module_handler, $plugin_interface=NULL, $plugin_definition_annotation_name= 'Drupal\Component\Annotation\Plugin')
 
 setCacheBackend (CacheBackendInterface $cache_backend, $cache_key, array $cache_tags=array())
 
 getDefinitions ()
 
 clearCachedDefinitions ()
 
 useCaches ($use_caches=FALSE)
 
 processDefinition (&$definition, $plugin_id)
 
- Public Member Functions inherited from PluginManagerBase
 getDefinition ($plugin_id, $exception_on_invalid=TRUE)
 
 getDefinitions ()
 
 createInstance ($plugin_id, array $configuration=array())
 
 getInstance (array $options)
 
- Public Member Functions inherited from DiscoveryInterface
 hasDefinition ($plugin_id)
 

Protected Member Functions

 alterInfo ($alter_hook)
 
 getCachedDefinitions ()
 
 setCachedDefinitions ($definitions)
 
 getDiscovery ()
 
 getFactory ()
 
 findDefinitions ()
 
 alterDefinitions (&$definitions)
 
 providerExists ($provider)
 
- Protected Member Functions inherited from PluginManagerBase
 getDiscovery ()
 
 getFactory ()
 

Protected Attributes

 $cacheKey
 
 $cacheTags = array()
 
 $alterHook
 
 $subdir
 
 $moduleHandler
 
 $defaults = array()
 
 $pluginDefinitionAnnotationName
 
 $pluginInterface
 
 $namespaces
 
- Protected Attributes inherited from PluginManagerBase
 $discovery
 
 $factory
 
 $mapper
 

Detailed Description

Base class for plugin managers.

Constructor & Destructor Documentation

__construct (   $subdir,
\Traversable  $namespaces,
ModuleHandlerInterface  $module_handler,
  $plugin_interface = NULL,
  $plugin_definition_annotation_name = 'Drupal\Component\Annotation\Plugin' 
)

Creates the discovery object.

Parameters
string | bool$subdirThe plugin's subdirectory, for example Plugin/views/filter.
\Traversable$namespacesAn object that implements which contains the root paths keyed by the corresponding namespace to look for plugin implementations.
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler.
string | null$plugin_interface(optional) The interface each plugin should implement.
string$plugin_definition_annotation_name(optional) The name of the annotation that contains the plugin definition. Defaults to 'Drupal'.

References Drupal\moduleHandler().

Here is the call graph for this function:

Member Function Documentation

alterDefinitions ( $definitions)
protected

Invokes the hook to alter the definitions if the alter hook is set.

Parameters
$definitionsThe discovered plugin definitions.

References Drupal\moduleHandler().

Referenced by EntityTypeManager\findDefinitions(), and DefaultPluginManager\findDefinitions().

Here is the call graph for this function:

Here is the caller graph for this function:

alterInfo (   $alter_hook)
protected
clearCachedDefinitions ( )

{Clears static and persistent plugin definition caches.Don't resort to calling ::cache()->delete() and friends to make Drupal detect new or updated plugin definitions. Always use this method on the appropriate plugin type's plugin manager!}

Implements CachedDiscoveryInterface.

References Cache\invalidateTags().

Here is the call graph for this function:

findDefinitions ( )
protected

Finds plugin definitions.

Returns
array List of definitions to store in cache.

References DefaultPluginManager\alterDefinitions(), DefaultPluginManager\getDiscovery(), DefaultPluginManager\processDefinition(), and DefaultPluginManager\providerExists().

Referenced by DefaultPluginManager\getDefinitions().

Here is the call graph for this function:

Here is the caller graph for this function:

getCachedDefinitions ( )
protected

Returns the cached plugin definitions of the decorated discovery class.

Returns
array|null On success this will return an array of plugin definitions. On failure this should return NULL, indicating to other methods that this has not yet been defined. Success with no values should return as an empty array and would actually be returned by the getDefinitions() method.

Referenced by DefaultPluginManager\getDefinitions().

Here is the caller graph for this function:

getDiscovery ( )
protected

{}

Referenced by EntityTypeManager\findDefinitions(), and DefaultPluginManager\findDefinitions().

Here is the caller graph for this function:

getFactory ( )
protected

{}

Referenced by ConditionManager\createInstance().

Here is the caller graph for this function:

processDefinition ( $definition,
  $plugin_id 
)

Performs extra processing on plugin definitions.

By default we add defaults for the type to the definition. If a type has additional processing logic they can do that by replacing or extending the method.

References NestedArray\mergeDeep().

Referenced by EntityTypeManager\findDefinitions(), and DefaultPluginManager\findDefinitions().

Here is the call graph for this function:

Here is the caller graph for this function:

providerExists (   $provider)
protected

Determines if the provider of a definition exists.

Returns
bool TRUE if provider exists, FALSE otherwise.

References Drupal\moduleHandler().

Referenced by DefaultPluginManager\findDefinitions().

Here is the call graph for this function:

Here is the caller graph for this function:

setCacheBackend ( CacheBackendInterface  $cache_backend,
  $cache_key,
array  $cache_tags = array() 
)

Initialize the cache backend.

Plugin definitions are cached using the provided cache backend. The interface language is added as a suffix to the cache key.

Parameters
\Drupal\Core\Cache\CacheBackendInterface$cache_backendCache backend instance to use.
string$cache_keyCache key prefix to use, the language code will be appended automatically.
array$cache_tags(optional) When providing a list of cache tags, the cached plugin definitions are tagged with the provided cache tags. These cache tags can then be used to clear the corresponding cached plugin definitions. Note that this should be used with care! For clearing all cached plugin definitions of a plugin manager, call that plugin manager's clearCachedDefinitions() method. Only use cache tags when cached plugin definitions should be cleared along with other, related cache entries.

Referenced by SelectionPluginManager\__construct(), SearchPluginManager\__construct(), QueueWorkerManager\__construct(), TipPluginManager\__construct(), ViewsPluginManager\__construct(), ArchiverManager\__construct(), EditorManager\__construct(), VariantManager\__construct(), ResourcePluginManager\__construct(), InPlaceEditorManager\__construct(), FilterPluginManager\__construct(), ImageEffectManager\__construct(), ActionManager\__construct(), AggregatorPluginManager\__construct(), CKEditorPluginManager\__construct(), BlockManager\__construct(), ConditionManager\__construct(), ImageToolkitManager\__construct(), FieldTypePluginManager\__construct(), ConstraintManager\__construct(), ImageToolkitOperationManager\__construct(), FormatterPluginManager\__construct(), WidgetPluginManager\__construct(), MigratePluginManager\__construct(), TypedConfigManager\__construct(), ViewsHandlerManager\__construct(), ElementInfoManager\__construct(), ConfigMapperManager\__construct(), MailManager\__construct(), TypedDataManager\__construct(), EntityTypeManager\__construct(), ContextualLinkManager\__construct(), BreakpointManager\__construct(), LocalActionManager\__construct(), and LocalTaskManager\__construct().

Here is the caller graph for this function:

setCachedDefinitions (   $definitions)
protected

Sets a cache of plugin definitions for the decorated discovery class.

Parameters
array$definitionsList of definitions to store in cache.

References Cache\PERMANENT.

Referenced by DefaultPluginManager\getDefinitions().

Here is the caller graph for this function:

useCaches (   $use_caches = FALSE)

{Disable the use of caches.Can be used to ensure that uncached plugin definitions are returned, without invalidating all cached information.This will also remove all local/static caches.

Parameters
bool$use_cachesFALSE to not use any caches.
}

Implements CachedDiscoveryInterface.


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