Drupal 8  8.0.2
FormatterPluginManager Class Reference
Inheritance diagram for FormatterPluginManager:

Public Member Functions

 __construct (\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, FieldTypePluginManagerInterface $field_type_manager)
 
 createInstance ($plugin_id, array $configuration=array())
 
 getInstance (array $options)
 
 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

 $formatterOptions
 
 $fieldTypeManager
 
- 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 formatters.

Constructor & Destructor Documentation

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

Constructs a FormatterPluginManager 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 FormatterPluginManager\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 formatter.

Parameters
string$typeA field formatter type name.
Returns
array The formatter 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 FormatterPluginManager\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.
  • view_mode: (string) The view mode.
  • prepare: (bool, optional) Whether default values should get merged in the 'configuration' array. Defaults to TRUE.
  • configuration: (array) the configuration for the formatter. The following key value pairs are allowed, and are all optional if 'prepare' is TRUE:
    • label: (string) Position of the label. The default 'field' theme implementation supports the values 'inline', 'above' and 'hidden'. Defaults to 'above'.
    • type: (string) The formatter to use. Defaults to the 'default_formatter' for the field type, The default formatter will also be used if the requested formatter is not available.
    • settings: (array) Settings specific to the formatter. Each setting defaults to the default value specified in the formatter definition.
    • third_party_settings: (array) Settings provided by other extensions through hook_field_formatter_third_party_settings_form().
Returns
|null A formatter object or NULL when plugin is not found.

Implements MapperInterface.

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

Here is the call graph for this function:

getOptions (   $field_type = NULL)

Returns an array of formatter options for a field type.

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

References DefaultPluginManager\getDefinitions().

Here is the call graph for this function:

prepareConfiguration (   $field_type,
array  $configuration 
)

Merges default values for formatter configuration.

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

References FormatterPluginManager\getDefaultSettings().

Referenced by FormatterPluginManager\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: