function TestFieldPrepareViewFormatter::prepareView
Same name in other branches
- 9 core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php \Drupal\field_test\Plugin\Field\FieldFormatter\TestFieldPrepareViewFormatter::prepareView()
- 8.9.x core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php \Drupal\field_test\Plugin\Field\FieldFormatter\TestFieldPrepareViewFormatter::prepareView()
- 10 core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php \Drupal\field_test\Plugin\Field\FieldFormatter\TestFieldPrepareViewFormatter::prepareView()
Overrides FormatterBase::prepareView
File
-
core/
modules/ field/ tests/ modules/ field_test/ src/ Plugin/ Field/ FieldFormatter/ TestFieldPrepareViewFormatter.php, line 62
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.