getEntity(); $elements = []; foreach ($this->getEntitiesToView($items, $langcode) as $delta => $entity) { $parent_entity->rss_elements[] = [ 'key' => 'category', 'value' => $entity->label(), 'attributes' => [ 'domain' => $entity->id() ? \Drupal::url('entity.taxonomy_term.canonical', ['taxonomy_term' => $entity->id()], ['absolute' => TRUE]) : '', ], ]; } return $elements; } /** * {@inheritdoc} */ public static function isApplicable(FieldDefinitionInterface $field_definition) { // This formatter is only available for taxonomy terms. return $field_definition->getFieldStorageDefinition()->getSetting('target_type') == 'taxonomy_term'; } }