Drupal 8  8.0.2
WidgetPluginManager Class Reference
Inheritance diagram for WidgetPluginManager:

Public Member Functions

 __construct (\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager)
 
 getInstance (array $options)
 
 createInstance ($plugin_id, array $configuration=array())
 
 prepareConfiguration ($field_type, array $configuration)
 
 getOptions ($field_type=NULL)
 
 getDefaultSettings ($type)
 
- Public Member Functions inherited from DefaultPluginManager
 __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 Attributes

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

Additional Inherited Members

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

Detailed Description

Plugin type manager for field widgets.

Constructor & Destructor Documentation

__construct ( \Traversable  $namespaces,
CacheBackendInterface  $cache_backend,
ModuleHandlerInterface  $module_handler,
FieldTypePluginManagerInterface  $field_type_manager 
)

Constructs a WidgetPluginManager object.

Parameters
\Traversable$namespacesAn object that implements which contains the root paths keyed by the corresponding namespace to look for plugin implementations.
\Drupal\Core\Cache\CacheBackendInterface$cache_backendCache backend instance to use.
\Drupal\Core\Extension\ModuleHandlerInterface$module_handlerThe module handler.
\Drupal\Core\Field\FieldTypePluginManagerInterface$field_type_managerThe 'field type' plugin manager.

References DefaultPluginManager\alterInfo(), and DefaultPluginManager\setCacheBackend().

Here is the call graph for this function:

Member Function Documentation

createInstance (   $plugin_id,
array  $configuration = array() 
)

{Creates a pre-configured instance of a plugin.

Parameters
string$plugin_idThe ID of the plugin being instantiated.
array$configurationAn array of configuration relevant to the plugin instance.
Returns
object A fully configured plugin instance.
Exceptions
\Drupal\Component\Plugin\Exception\PluginExceptionIf the instance cannot be created, such as if the ID is invalid.
}

Implements FactoryInterface.

References Drupal\getContainer(), PluginManagerBase\getDefinition(), and DefaultFactory\getPluginClass().

Referenced by WidgetPluginManager\getInstance().

Here is the call graph for this function:

Here is the caller graph for this function:

getDefaultSettings (   $type)

Returns the default settings of a field widget.

Parameters
string$typeA field widget type name.
Returns
array The widget type's default settings, as provided by the plugin definition, or an empty array if type or settings are undefined.

References PluginManagerBase\getDefinition(), and DefaultFactory\getPluginClass().

Referenced by WidgetPluginManager\prepareConfiguration().

Here is the call graph for this function:

Here is the caller graph for this function:

getInstance ( array  $options)

Overrides PluginManagerBase::getInstance().

Parameters
array$optionsAn array with the following key/value pairs:
  • field_definition: (FieldDefinitionInterface) The field definition.
  • form_mode: (string) The form mode.
  • prepare: (bool, optional) Whether default values should get merged in the 'configuration' array. Defaults to TRUE.
  • configuration: (array) the configuration for the widget. The following key value pairs are allowed, and are all optional if 'prepare' is TRUE:
    • type: (string) The widget to use. Defaults to the 'default_widget' for the field type. The default widget will also be used if the requested widget is not available.
    • settings: (array) Settings specific to the widget. Each setting defaults to the default value specified in the widget definition.
    • third_party_settings: (array) Settings provided by other extensions through hook_field_formatter_third_party_settings_form().
Returns
|null A Widget object or NULL when plugin is not found.

Implements MapperInterface.

References WidgetPluginManager\createInstance(), PluginManagerBase\getDefinition(), and WidgetPluginManager\prepareConfiguration().

Here is the call graph for this function:

getOptions (   $field_type = NULL)

Returns an array of widget type options for a field type.

Parameters
string | null$field_type(optional) The name of a field type, or NULL to retrieve all widget options. Defaults to NULL.
Returns
array If no field type is provided, returns a nested array of all widget types, keyed by field type human name.

References DefaultPluginManager\getDefinitions().

Here is the call graph for this function:

prepareConfiguration (   $field_type,
array  $configuration 
)

Merges default values for widget configuration.

Parameters
string$field_typeThe field type.
array$configurationAn array of widget configuration.
Returns
array The display properties with defaults added.

References WidgetPluginManager\getDefaultSettings().

Referenced by WidgetPluginManager\getInstance().

Here is the call graph for this function:

Here is the caller graph for this function:


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