Options to limit the number of item displayed in a views field

DeFr - October 2, 2009 - 09:51
Project:NodeReferrer
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:DeFr
Status:needs review
Description

Right now, if you add a Node Referrer field to a View, you can choose if the values returned by nodereferrer_view_handler_field::referrers should be displayed as a list or comma separated, but you don't have any control on the number of items that are displayed.

Such a setting can be usefull if you only want the field to display the last node that referenced a given node, instead of all of them.

Attached patch adds such a setting in nodereferrer_view_handler_field::options_form, and uses it in nodereferrer_view_handler_field::render to limit the displayed result.

Another approach would be to pass the maximum number of elements to retrieve all the way down to nodereferrer_referrers and use it as a LIMIT in the SQL-query: that would be a bit more efficient, but would make the patch a lot more invasive.

AttachmentSize
allow-field-limit-form-setting.patch1.14 KB

#1

andypost - October 4, 2009 - 17:34

Great addition!
Patch looks good for me. But I need more reviews to commit.

 
 

Drupal is a registered trademark of Dries Buytaert.