You are here

protected function CpfDigitsFormatter::viewValue in CPF 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/CpfDigitsFormatter.php \Drupal\cpf\Plugin\Field\FieldFormatter\CpfDigitsFormatter::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 CpfDigitsFormatter::viewValue()
CpfDigitsFormatter::viewElements in src/Plugin/Field/FieldFormatter/CpfDigitsFormatter.php
Builds a renderable array for a field value.

File

src/Plugin/Field/FieldFormatter/CpfDigitsFormatter.php, line 44

Class

CpfDigitsFormatter
Plugin implementation of the 'cpf_digits' formatter.

Namespace

Drupal\cpf\Plugin\Field\FieldFormatter

Code

protected function viewValue(FieldItemInterface $item) {
  return \Drupal::service('cpf')
    ->digits($item->value);
}