protected function ComputedFormatter::viewValue in Computed Field 8
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 ComputedFormatter::viewValue()
- ComputedFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ ComputedFormatter.php - Builds a renderable array for a field value.
File
- src/
Plugin/ Field/ FieldFormatter/ ComputedFormatter.php, line 81
Class
- ComputedFormatter
- Plugin implementation of the 'computed' formatter.
Namespace
Drupal\computed_field\Plugin\Field\FieldFormatterCode
protected function viewValue(FieldItemInterface $item) {
$display_output = $item
->executeDisplayCode();
if ($this
->getSetting('sanitized')) {
return nl2br(SafeMarkup::checkPlain($display_output));
}
else {
return nl2br($display_output);
}
}