You are here

protected function ColorboxFieldFormatter::viewValue in Colorbox field formatter 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Field/FieldFormatter/ColorboxFieldFormatter.php \Drupal\colorbox_field_formatter\Plugin\Field\FieldFormatter\ColorboxFieldFormatter::viewValue()

Generate the output appropriate for one field item.

Parameters

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

Return value

string|array The textual output generated.

1 call to ColorboxFieldFormatter::viewValue()
ColorboxFieldFormatter::viewElements in src/Plugin/Field/FieldFormatter/ColorboxFieldFormatter.php
2 methods override ColorboxFieldFormatter::viewValue()
ColorboxFieldFormatterEntityreference::viewValue in src/Plugin/Field/FieldFormatter/ColorboxFieldFormatterEntityreference.php
Generate the output appropriate for one field item.
ColorboxFieldFormatterImage::viewValue in src/Plugin/Field/FieldFormatter/ColorboxFieldFormatterImage.php
Generate the output appropriate for one field item.

File

src/Plugin/Field/FieldFormatter/ColorboxFieldFormatter.php, line 304

Class

ColorboxFieldFormatter
Plugin implementation of the 'colorbox_field_formatter' formatter.

Namespace

Drupal\colorbox_field_formatter\Plugin\Field\FieldFormatter

Code

protected function viewValue(FieldItemInterface $item) {

  // The text value has no text format assigned to it, so the user input
  // should equal the output, including newlines.

  /** @noinspection PhpUndefinedFieldInspection */
  return nl2br(Html::escape($item->value));
}