When defining a Contextual Filter, one can specify the behavior for cases when the filter value is not available. If "Display a summary" is chosen, one has the option to display the summary as a List, Unformatted, or Jump Menu.

When List or Unformatted is chosen, an option is available: "Override number of items to display." This will override the normal "items per page" setting on the view. But, the Jump Menu lacks this option. The Jump Menu will always show ALL values for the summary.

This makes sense, since the List and Unformatted options can be displayed with a pager, but that's not an option when displaying a select list for the Jump Menu. Still, there's at least one use case for it: I'd like to display a jump menu for a monthly archive view, but only list the past 12 months in the jump menu.

CommentFileSizeAuthor
#1 1572438-1.patch2.32 KBBrockBoland
List.png84.25 KBBrockBoland
JumpMenu.png108.66 KBBrockBoland
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

BrockBoland’s picture

Status: Active » Needs review
FileSize
2.32 KB

A first pass at this is attached. I'm not sure how to modify the query that's used to generate the summary list: right now, it keeps count as the render() function loops over $this->view->result. This works, but there's unnecessary overhead because $this->view->result will include more items than it needs to.

dawehner’s picture

Status: Needs review » Needs work
+++ b/plugins/views_plugin_style_summary_jump_menu.incundefined
@@ -95,7 +111,12 @@ class views_plugin_style_summary_jump_menu extends views_plugin_style {
+    $item_count = 0;
     foreach ($this->view->result as $id => $row) {
+      if (!empty($this->options['override']) && $item_count >= $this->options['items_per_page']) {
+        break;

I'm wondering why we can't simply set $this->view->set_items_per_page in the query method like views_plugin_style_summary ... Actually i'm wondering why this code doesn't extend views_plugin_style_summary