1

In my ongoing journey to create a customized RSS feed in my D8 site, I've finally gotten closest to what I need by using a Feed display in Views. The basic feed is working, but I need to add a couple custom elements for each item. So based on the fact that the rss fields are rendered in the RSSFields class (\Drupal\views\Plugin\views\row)

namespace Drupal\video_export\Plugin\views\row;

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

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


  public function render($row) {
    parent::render();  



  }
}

So when I place this in /modules/custom/video_export/src/Plugin/views/row, if I go to select the style, I see my new plugin, but when I click Apply, nothing happens. Is there anything else I need to add to my override to get it to save?

1

The issue was an incomplete namespace in the use statement for the RssFields class. I had

use Drupal\views\Plugin\views\row;

so it was looking for that class in my module. Changing it to

use Drupal\views\Plugin\views\row\RssFields;

made everything work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.