You are here

protected function TelephoneFormatter::viewPlainValue in Telephone Formatter 8

Generate the output appropriate for one field item.

Parameters

\Drupal\Core\Field\FieldItemInterface $item: One field value.

Return value

array The textual output generated as a render array.

1 call to TelephoneFormatter::viewPlainValue()
TelephoneFormatter::viewElements in src/Plugin/Field/FieldFormatter/TelephoneFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/TelephoneFormatter.php, line 178

Class

TelephoneFormatter
Plugin implementation of the 'telephone_formatter' formatter.

Namespace

Drupal\telephone_formatter\Plugin\Field\FieldFormatter

Code

protected function viewPlainValue(FieldItemInterface $item) {

  // The text value has no text format assigned to it, so the user input
  // should equal the output.
  return [
    '#type' => 'inline_template',
    '#template' => '{{ value }}',
    '#context' => [
      'value' => $item->value,
    ],
  ];
}