You are here

protected function CpfMaskFormatter::viewValue in CPF 8

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

File

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

Class

CpfMaskFormatter
Plugin implementation of the 'cpf_mask' formatter.

Namespace

Drupal\cpf\Plugin\Field\FieldFormatter

Code

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