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.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 1246710-view-user-row-plugin.patch | 8.61 KB | dave reid |
| #6 | 1243220-views-cleanup-rss-handling.patch | 8.68 KB | dave reid |
| #4 | 1243220-views-cleanup-rss-handling.patch | 8.68 KB | dave reid |
| views-node-rss-node-view.patch | 1.01 KB | haffmans |
Comments
Comment #1
dawehnerIf we don't use $node->content it might be cleaner to change it to $build['links'] here as well?
Comment #2
dawehnerTo whatever reason this patch doesn't apply anymore.
Comment #3
dave reidI'm on it.
Comment #4
dave reidIn 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)?
Comment #5
dave reidSeparate RFC for comment RSS row plugin created at #1267976: RFC: Move the comment RSS row handler to commentrss.module
Comment #6
dave reidI accidentally used $uri['option'] instead of $uri['options'] causing a fatal error.
Comment #7
dave reidComment #8
dawehnerRead 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