Question

I need to add an image to the RSS feed. So I create a new row plugin for the RSS and it extends RssFields row plugin.

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

I can select it in the format settings.

FORMAT settings

And it seems that works perfectly when I update the preview, I can see a new field image on every item of the RSS. But when the RSS feed is rendered, it uses the RssFields plugin instead of the ImageFieldForRssFields plugin that is setted.

I debugged it and it seems that always renders the RssFields plugin even if I delete the RssFields plugin, the view tries to locate it.

Am I missing something? How do I have to do to render the correct plugin?

Was it helpful?

Solution

There is a patch to add an image as an enclosure field to core here:

https://www.drupal.org/project/drupal/issues/2511878

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top