function TestFieldPrepareViewFormatter::prepareView
Overrides FormatterBase::prepareView
File
- 
              core/modules/ field/ tests/ modules/ field_test/ src/ Plugin/ Field/ FieldFormatter/ TestFieldPrepareViewFormatter.php, line 60 
Class
- TestFieldPrepareViewFormatter
- Plugin implementation of the 'field_test_with_prepare_view' formatter.
Namespace
Drupal\field_test\Plugin\Field\FieldFormatterCode
public function prepareView(array $entities_items) {
  foreach ($entities_items as $items) {
    foreach ($items as $item) {
      // Don't add anything on empty values.
      if (!$item->isEmpty()) {
        $item->additional_formatter_value = $item->value + 1;
      }
    }
  }
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
