You are here

protected function PhoneInternationalDefaultFormatter::viewValue in International Phone 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/PhoneInternationalDefaultFormatter.php \Drupal\phone_international\Plugin\Field\FieldFormatter\PhoneInternationalDefaultFormatter::viewValue()
  2. 3.x src/Plugin/Field/FieldFormatter/PhoneInternationalDefaultFormatter.php \Drupal\phone_international\Plugin\Field\FieldFormatter\PhoneInternationalDefaultFormatter::viewValue()

Generate the output appropriate for one field item.

Parameters

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

Return value

string The textual output generated.

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

File

src/Plugin/Field/FieldFormatter/PhoneInternationalDefaultFormatter.php, line 62

Class

PhoneInternationalDefaultFormatter
Plugin implementation of the 'phone_international_formatter' formatter.

Namespace

Drupal\phone_international\Plugin\Field\FieldFormatter

Code

protected function viewValue(FieldItemInterface $item) {

  // The text value has no text format assigned to it, so the user input
  // should equal the output, including newlines.
  return nl2br(Html::escape($item->value));
}