Drupal 8  8.0.2
StringFormatter Class Reference
Inheritance diagram for StringFormatter:

Public Member Functions

 __construct ($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings, EntityManagerInterface $entity_manager)
 
 settingsForm (array $form, FormStateInterface $form_state)
 
 settingsSummary ()
 
 viewElements (FieldItemListInterface $items, $langcode)
 
- Public Member Functions inherited from FormatterBase
 __construct ($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, $label, $view_mode, array $third_party_settings)
 
 view (FieldItemListInterface $items, $langcode=NULL)
 
 settingsForm (array $form, FormStateInterface $form_state)
 
 settingsSummary ()
 
 prepareView (array $entities_items)
 
- Public Member Functions inherited from PluginSettingsBase
 getSettings ()
 
 getSetting ($key)
 
 setSettings (array $settings)
 
 setSetting ($key, $value)
 
 getThirdPartySettings ($module=NULL)
 
 getThirdPartySetting ($module, $key, $default=NULL)
 
 setThirdPartySetting ($module, $key, $value)
 
 unsetThirdPartySetting ($module, $key)
 
 getThirdPartyProviders ()
 
 calculateDependencies ()
 
 onDependencyRemoval (array $dependencies)
 
- Public Member Functions inherited from PluginInspectionInterface
 getPluginId ()
 
 getPluginDefinition ()
 

Static Public Member Functions

static create (ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
 
static defaultSettings ()
 
- Static Public Member Functions inherited from FormatterBase
static isApplicable (FieldDefinitionInterface $field_definition)
 
- Static Public Member Functions inherited from PluginSettingsBase
static defaultSettings ()
 

Protected Member Functions

 viewValue (FieldItemInterface $item)
 
- Protected Member Functions inherited from FormatterBase
 getFieldSettings ()
 
 getFieldSetting ($setting_name)
 
- Protected Member Functions inherited from PluginSettingsBase
 mergeDefaults ()
 

Additional Inherited Members

- Protected Attributes inherited from FormatterBase
 $fieldDefinition
 
 $settings
 
 $label
 
 $viewMode
 
- Protected Attributes inherited from PluginSettingsBase
 $settings = array()
 
 $thirdPartySettings = array()
 
 $defaultSettingsMerged = FALSE
 

Detailed Description

Plugin implementation of the 'string' formatter.

( id = "string", label = ("Plain text"), field_types = { "string", "uri", }, quickedit = { "editor" = "plain_text" } )

Constructor & Destructor Documentation

__construct (   $plugin_id,
  $plugin_definition,
FieldDefinitionInterface  $field_definition,
array  $settings,
  $label,
  $view_mode,
array  $third_party_settings,
EntityManagerInterface  $entity_manager 
)

Constructs a StringFormatter instance.

Parameters
string$plugin_idThe plugin_id for the formatter.
mixed$plugin_definitionThe plugin implementation definition.
\Drupal\Core\Field\FieldDefinitionInterface$field_definitionThe definition of the field to which the formatter is associated.
array$settingsThe formatter settings.
string$labelThe formatter label display setting.
string$view_modeThe view mode.
array$third_party_settingsAny third party settings settings.
\Drupal\Core\Entity\EntityManagerInterface$entity_managerThe entity manager.

References Drupal\entityManager().

Here is the call graph for this function:

Member Function Documentation

static create ( ContainerInterface  $container,
array  $configuration,
  $plugin_id,
  $plugin_definition 
)
static

{Creates an instance of the plugin.

Parameters
\Symfony\Component\DependencyInjection\ContainerInterface$containerThe container to pull out services used in the plugin.
array$configurationA configuration array containing information about the plugin instance.
string$plugin_idThe plugin ID for the plugin instance.
mixed$plugin_definitionThe plugin implementation definition.
Returns
static Returns an instance of this plugin.
}

Implements ContainerFactoryPluginInterface.

static defaultSettings ( )
static

{Defines the default settings for this plugin.

Returns
array A list of default settings, keyed by the setting name.
}

Implements PluginSettingsInterface.

settingsForm ( array  $form,
FormStateInterface  $form_state 
)

{Returns a form to configure settings for the formatter.Invoked from to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.

Parameters
array$formThe form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface$form_stateThe current state of the form.
Returns
array The form elements for the formatter settings.
}

Implements FormatterInterface.

References Drupal\entityManager(), PluginSettingsBase\getSetting(), and t().

Here is the call graph for this function:

settingsSummary ( )

{Returns a short summary for the current formatter settings.If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.

Returns
string[] A short summary of the formatter settings.
}

Implements FormatterInterface.

References Drupal\entityManager(), PluginSettingsBase\getSetting(), and t().

Here is the call graph for this function:

viewElements ( FieldItemListInterface  $items,
  $langcode 
)

{Builds a renderable array for a field value.

Parameters
\Drupal\Core\Field\FieldItemListInterface$itemsThe field values to be rendered.
string$langcodeThe language that should be used to render the field.
Returns
array A renderable array for $items, as an array of child elements keyed by consecutive numeric indexes starting from 0.
}

Implements FormatterInterface.

References FieldItemListInterface\getEntity(), PluginSettingsBase\getSetting(), and StringFormatter\viewValue().

Here is the call graph for this function:

viewValue ( FieldItemInterface  $item)
protected

Generate the output appropriate for one field item.

Parameters
\Drupal\Core\Field\FieldItemInterface$itemOne field item.
Returns
array The textual output generated as a render array.

Referenced by StringFormatter\viewElements().

Here is the caller graph for this function:


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