You are here

protected function PanelizerFormatter::viewValue in Panelizer 8.3

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

File

src/Plugin/Field/FieldFormatter/PanelizerFormatter.php, line 50

Class

PanelizerFormatter
Plugin implementation of the 'panelizer' formatter.

Namespace

Drupal\panelizer\Plugin\Field\FieldFormatter

Code

protected function viewValue(FieldItemInterface $item) {
  $description = '';
  if (!empty($item->default)) {
    $description = $this
      ->t('Using default called "@default"', [
      '@default' => $item->default,
    ]);
  }
  else {
    $description = $this
      ->t('Custom');
  }
  return $description;
}