I have been playing with Views RSS module (7.x). I found this is really robust and versatile to create a RSS feed easily from Drupal contents. I never worked with RSS before and it is good to pick up the W3 specifications and all.
One of the kinks (well, it is not really) I had was to follow the channel image specification: https://validator.w3.org/feed/docs/rss2.html#ltimagegtSubelementOfLtchannelgt
In there, it only allows:
- Maximum value for width is 144, default value is 88.
- Maximum value for height is 400, default value is 31.
However, I had to increase the image size for some reason. The Views RSS module conveniently has some hooks. By this, I could easily extend and custormize RSS feeds.
Hooks for defining new namespaces, <channel> and <item> elements, and date sources:
- hook_views_rss_namespaces()
- hook_views_rss_channel_elements()
- hook_views_rss_item_elements()
- hook_views_rss_date_sources()
Hooks for altering definitions provide:
- hook_views_rss_namespaces_alter(&$namespaces)
- hook_views_rss_channel_elements_alter(&$elements)
- hook_views_rss_item_elements_alter(&$elements)
- hook_views_rss_date_sources_alter(&$date_sources)
Hooks for processing admin configuration form:
- hook_views_rss_options_form_validate($form, &$form_state);
- hook_views_rss_options_form_submit($form, &$form_state);
In my case, it only takes two hook functions. In the modules:
/** * Implements hook_views_rss_channel_elements(). * * Add a new RSS Channel field for adding a new image */ function MODULE_views_rss_channel_elements() { $elements['custom_image'] = array( 'title' => t('My Custom Image'), 'description' => t('It replaces the above Core Image for the feed. Please leave the Core Image field empty when inserting and updating.'), ); return $elements; } /** * Implements hook_views_rss_options_form_validate(). * * Walk around the RSS Channel image restriction (144 X 400) */ function MODULE_rss_options_form_validate($form, &$form_state) { if (!empty($form_state['values']['style_options']['channel']['core']['my_custom']['custom_image'])) { $form_state['values']['style_options']['channel']['core']['views_rss_core']['image'] = $form_state['values']['style_options']['channel']['core']['my_custom']['custom_image']; } }