You are here

public function SettingTrait::formatter in Fasttoggle 8.2

Get the markup we modify.

Parameters

\Drupal\Core\Field\FieldItemList $items: The items to be displayed.

array $config: The cached configuration used to generate the original link.

File

src/Plugin/Setting/SettingTrait.php, line 362
Fasttoggle Object List of Values Setting

Class

SettingTrait
Abstract interface for settings.

Namespace

Drupal\fasttoggle\Plugin\Setting

Code

public function formatter(FieldItemList $items, $config) {
  $plugin_id = 'fasttoggle';
  $plugin_definition = $config['plugin_definition'];
  $field_definition = $config['field_definition'];
  $settings = $config['formatter_settings'];
  $label = $config['label'];
  $view_mode = $config['view_mode'];
  $third_party_settings = $config['third_party_settings'];
  $formatter_class = $this
    ->getPluginDefinition()['base_formatter'];
  $formatter = new $formatter_class($plugin_id, $plugin_definition, $field_definition, $settings, $label, $view_mode, $third_party_settings);
  return $formatter
    ->viewElements($items, $config['langcode']);
}