You are here

protected function ComputedStringFormatter::prepareValue in Computed Field 8.2

Same name and namespace in other branches
  1. 3.x src/Plugin/Field/FieldFormatter/ComputedStringFormatter.php \Drupal\computed_field\Plugin\Field\FieldFormatter\ComputedStringFormatter::prepareValue()

@inheritdoc

Overrides ComputedFormatterBase::prepareValue

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

File

src/Plugin/Field/FieldFormatter/ComputedStringFormatter.php, line 57

Class

ComputedStringFormatter
Plugin implementation of the 'computed_string' formatter.

Namespace

Drupal\computed_field\Plugin\Field\FieldFormatter

Code

protected function prepareValue($value) {
  if ($this
    ->getSetting('sanitized')) {
    return nl2br(Html::escape($value));
  }
  else {
    return nl2br($value);
  }
}