'bar', ] + parent::defaultSettings(); } /** * {@inheritdoc} */ public function settingsForm(array $form, FormStateInterface $form_state) { $elements['foo'] = [ '#type' => 'textfield', '#title' => $this->t('Foo'), '#default_value' => $this->getSetting('foo'), ]; return $elements; } /** * {@inheritdoc} */ public function settingsSummary() { $summary[] = $this->t('Foo: @foo', ['@foo' => $this->getSetting('foo')]); return $summary; } {% endif %} /** * {@inheritdoc} */ public function viewElements(FieldItemListInterface $items, $langcode) { $element = []; foreach ($items as $delta => $item) { $element[$delta] = [ '#markup' => $item->value, ]; } return $element; } }