You are here

public function ListFormatter::defaultFieldList in Text list formatter 8.2

Default listing callback.

1 call to ListFormatter::defaultFieldList()
ListFormatter::viewElements in lib/Drupal/textformatter/Plugin/field/formatter/ListFormatter.php
Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::viewElements().

File

lib/Drupal/textformatter/Plugin/field/formatter/ListFormatter.php, line 308
Definition of Drupal\textformatter\Plugin\field\formatter\List;

Class

ListFormatter
Plugin implementation of the 'text_default' formatter.

Namespace

Drupal\textformatter\Plugin\field\formatter

Code

public function defaultFieldList(EntityInterface $entity, $langcode, array $items) {
  $list_items = array();

  // Use our helper function to get the value key dynamically.
  $value_key = _textformatter_get_field_value_key($this->field);
  foreach ($items as $delta => $item) {
    $list_items[$delta] = check_plain($item[$value_key]);
  }
  return $list_items;
}