Pull merge.
[yaffs-website] / web / core / lib / Drupal / Core / Field / Plugin / Field / FieldFormatter / NumericUnformattedFormatter.php
1 <?php
2
3 namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;
4
5 use Drupal\Core\Field\FormatterBase;
6 use Drupal\Core\Field\FieldItemListInterface;
7
8 /**
9  * Plugin implementation of the 'number_unformatted' formatter.
10  *
11  * @FieldFormatter(
12  *   id = "number_unformatted",
13  *   label = @Translation("Unformatted"),
14  *   field_types = {
15  *     "integer",
16  *     "decimal",
17  *     "float"
18  *   }
19  * )
20  */
21 class NumericUnformattedFormatter extends FormatterBase {
22
23   /**
24    * {@inheritdoc}
25    */
26   public function viewElements(FieldItemListInterface $items, $langcode) {
27     $elements = [];
28
29     foreach ($items as $delta => $item) {
30       $elements[$delta] = ['#markup' => $item->value];
31     }
32
33     return $elements;
34   }
35
36 }