/** * {@inheritdoc} */ public function settingsSummary() { $summary = parent::settingsSummary(); if ($this->getSetting('native_language')) { $summary[] = $this->t('Displayed in native language'); } return $summary; }
/** * {@inheritdoc} */ public function prepareView(array $entities_items) { // Todo: implement prepareView. (if necessary: replaces D7's hook_field_prepare_view()) /* D7: $languages = _languagefield_options($field['settings']['language_range'], $langcode); D8: $languages = LanguageItem::getPossibleValues(...); foreach ($entities as $id => $object) { foreach ($items[$id] as $delta => $item) { // Check if item value is set, otherwise continue to next item. if (!empty($item['value'])) { $items[$id][$delta] = $languages[$item['value']]; } } } */ return parent::prepareView($entities_items); }