You are here

protected function TelephoneFormatter::getFormattedValue in Telephone Formatter 8

Generate formatted output for one field item.

Helper function which helps you get field value formatted based on field formatter settings.

Parameters

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

Return value

string Returns preformatted telephone number.

2 calls to TelephoneFormatter::getFormattedValue()
TelephoneFormatter::viewFormattedValue in src/Plugin/Field/FieldFormatter/TelephoneFormatter.php
Generate the output appropriate for one field item.
TelephoneFormatter::viewLinkValue in src/Plugin/Field/FieldFormatter/TelephoneFormatter.php
Generate the output appropriate for one field item.

File

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

Class

TelephoneFormatter
Plugin implementation of the 'telephone_formatter' formatter.

Namespace

Drupal\telephone_formatter\Plugin\Field\FieldFormatter

Code

protected function getFormattedValue(FieldItemInterface $item) {
  return $this->formatter
    ->format($item->value, $this
    ->getSetting('format'), $this
    ->getSetting('default_country'));
}