function NumericUnformattedFormatter::viewElements

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericUnformattedFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericUnformattedFormatter::viewElements()
  2. 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericUnformattedFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericUnformattedFormatter::viewElements()
  3. 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericUnformattedFormatter.php \Drupal\Core\Field\Plugin\Field\FieldFormatter\NumericUnformattedFormatter::viewElements()

Overrides FormatterInterface::viewElements

1 call to NumericUnformattedFormatter::viewElements()
AttachmentTestFormatter::viewElements in core/modules/views/tests/modules/views_test_formatter/src/Plugin/Field/FieldFormatter/AttachmentTestFormatter.php
Builds a renderable array for a field value.
1 method overrides NumericUnformattedFormatter::viewElements()
AttachmentTestFormatter::viewElements in core/modules/views/tests/modules/views_test_formatter/src/Plugin/Field/FieldFormatter/AttachmentTestFormatter.php
Builds a renderable array for a field value.

File

core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/NumericUnformattedFormatter.php, line 26

Class

NumericUnformattedFormatter
Plugin implementation of the 'number_unformatted' formatter.

Namespace

Drupal\Core\Field\Plugin\Field\FieldFormatter

Code

public function viewElements(FieldItemListInterface $items, $langcode) {
    $elements = [];
    foreach ($items as $delta => $item) {
        $elements[$delta] = [
            '#markup' => $item->value,
        ];
    }
    return $elements;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.