When using the RSS Feed formatter, nodes are rendered using node_build_content(). This function skips the node_view_alter() hook (and entity_view_alter()), which contrib modules can use to modify the output of elements in Drupal Core (e.g. i18n uses this to modify/add translation links, as far as I know). As a result, the RSS feeds generated by Views differ from the Core feeds, mostly because these hooks are not executed.

I propose using node_view() instead of node_build_content() to get the actual contents to be shown in an RSS feed. This should make nodes render equally to Drupal core (node_feed() in node.module), which uses the same function (and executes the alter hooks). Attached patch should do this.

Comments

dawehner’s picture

Status:Needs review» Needs work
+++ b/modules/node/views_plugin_row_node_rss.incundefined
@@ -94,14 +94,15 @@ class views_plugin_row_node_rss extends views_plugin_row {
     if ($item_length != 'title' && !empty($node->content)) {

If we don't use $node->content it might be cleaner to change it to $build['links'] here as well?

dawehner’s picture

To whatever reason this patch doesn't apply anymore.

Dave Reid’s picture

Assigned:Unassigned» Dave Reid

I'm on it.

Dave Reid’s picture

Title:Use node_view() instead of node_build_content() for RSS style» Cleanup RSS content building and handling
Status:Needs work» Needs review
StatusFileSize
new8.68 KB

In updating the node RSS handling to use node_view() I found several other cleanups that needed to be done:
1. The RSS style handler should provide the default RSS namespace rather than have to re-implement it in each RSS row handler.
2. Update views_plugin_row_node_rss::render() to use the same code as node_feed() with the addition of using entity_uri() for $node->link.
3. Apply the same view logic to views_plugin_row_comment_rss to use comment_view(). This will remove problems for comments that do not have a 'comment_body' field or use alternate fields.

I wonder if we should be moving the row plugin for comment RSS to http://drupal.org/project/commentrss instead of leaving it in Views (especially considering that Comments to not have an RSS view mode in core)?

Dave Reid’s picture

Separate RFC for comment RSS row plugin created at #1267976: RFC: Move the comment RSS row handler to commentrss.module

Dave Reid’s picture

StatusFileSize
new8.68 KB

I accidentally used $uri['option'] instead of $uri['options'] causing a fatal error.

Dave Reid’s picture

StatusFileSize
new8.61 KB
dawehner’s picture

Status:Needs review» Fixed

Read the whole patch and it really improved readability of some parts. What means $row here, if you can have $comment.

Thanks!!!

Commited to 7.x-3.x

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.