Custom number of items in your Drupal website RSS feed

13 Sep 2011

Joris Snoek
Digital Consultant
+31 (0)20 - 261 14 99

Last week a customer asked us:

"How can I get 40 items in my RSS feed. On '/admin/content/rss-publishing' I can only choose 30 for maximum".

After a quick search I couldn't find a module that provided this.

So Lucius created a very small module that scratched his itch. Off course there are other ways, like creating a custom module to fill this number in a 'free' textfield and no dropdown box. But this did the trick for him.

This module consisted of a few lines of code that adds extra options in the form.

The allmighty code

/*
* Implementation of hook_form_alter
*/
function YOURMODULE_form_alter(&$form, $form_state, $form_id){

if($form_id == 'system_rss_feeds_settings'){
    // Added '40' in the array
   $form['feed_default_items']['#options'] = drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30, 40));
}
}

Copy and paste the lines in your code-editor, as it is too long for our content-space :-)

Feedback, Questions about RSS publishing?

Please hit me on Twitter for all your feedback, and any other issue!

Comments

Nóg meer
kennis nodig?

Check ons ons blog archief >