Override Views RSS Feed Display I've been struggling with trying to create a custom xml REST API in D8 to replace a simple Views RSS feed (that is imported into other D7 sites using a custom Feeds importer) in a D6 site that's being migrated, and after pulling my hair out with the custom REST endpoint, I'm looking at doing what I did in D6, which is to create a Views RSS display. However, the feed requires some customization, so I need to determine how to add custom fields to the RSS feed. For other feeds in D7 sites, I've used the Views RSS module to add fields, but the D8 branch is still apparently not stable, so that does not seem to be an option.

To customize my RSS feed, I need to do two things:


Add custom elements (hook_nodeapi($op = 'rss item') in D6)
Modify the query so only nodes with specified tids in a term reference field based on a views global null param passed in (hook_views_query_alter() in D6)


So it appears that for an RSS Feed display in D8 views, the only fields displayed in the feed are the ones predefined in the row style settings (using Fields as the row type). With the Views RSS module not being available, is there a way with core Views to override the view to add custom fields (such as a class override)? I appears I can still use hook_views_query_alter() to modify my query, but it doesn't do me much good if I can't add fields.

I could probably spend a few hours reading through code, but if anyone has a quick answer as to the best way to add custom elements to a D8 RSS display, or could point me in the right direction, I'd appreciate it.

Thanks.
As documented here, I went with overriding the views row style plugin. All I did in the override was add the render() method and add my own modifications to the $build array to make it work.

&lt;?php

namespace Drupal\video_export\Plugin\views\row;

use Drupal\views\Plugin\views\row\RssFields;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;

/**
 * Renders an RSS item based on fields.
 *
 * @ViewsRow(
 *   id = "mymodule_rss_fields",
 *   title = @Translation("Custom Fields"),
 *   help = @Translation("Display fields as RSS items."),
 *   theme = "views_view_row_rss",
 *   display_types = {"feed"}
 * )
 */
class MyModuleVRssFields extends RssFields {

  /**
   * Override of RssFields::render() with additional fields.
   *
   * @param object $row
   *
   * @return array
   */
  public function render($row) {
    $build = parent:: render();
    $item = $build['#row'];

    // Add MRCTV nid
    $item-&gt;elements[] = array(
      'key' =&gt; 'source-nid',
      'value' =&gt; $row-&gt;nid,
    );

    // Add channels and their target nids. We can get them from $row-&gt;_entity.
    $site = $this-&gt;view-&gt;args[0];
    // Get source nids from view.
    $channel_tids = array_column($row-&gt;_entity-&gt;field_channels-&gt;getValue(), 'target_id');
    // Now, get destination tids from config.
    $mapping_config = \Drupal::config('video_export.mappings');
    $all_mappings = $mapping_config-&gt;get('sites');

    foreach($channel_tids as $source_channel) {
      if(in_array($source_channel, array_keys($all_mappings[$site]['mappings']))) {
        $item-&gt;elements[] = array(
          'key' =&gt; $site . '-channel-map',
          'value' =&gt; $all_mappings[$site]['mappings'][$source_channel],
        );
      }
    }

    // Re-populate the $build array with the updated row.
    $build['#row'] = $item;

    return $build;
  }
}