In the Pager, there is an option for "Items to display". The description for it reads: "The number of items to display. Enter 0 for no limit."

If you put 0 in the field, it shows the text "Display a specified number of items | 0 items". This might be confusing for the user, it should be showing 0 items, instead it shows all of them. Perhaps change it to ""Display a specified number of items | all items" when user inputs 0 in the field?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Category: bug » task
Issue tags: +Novice

I agree that this can confuse people, even it should be actually better to use the none pager instead.

Ignigena’s picture

FileSize
779 bytes

This is limited to when the pager is manually set to "Display a specified number of items" and the value is set at "0". When creating a new view, if one types "0" in the "Items to display" option, Views will automatically set the appropriate pager setting to "Display all items" which shows a less confusing "Display all items | all items" message.

I would agree that it's confusing, and in the case the user does manually set the pager to "specified number" it might be better to have Views automatically switch the pager type back to "Display all items" for convenience if the "number of items" has been set to "0".

In the meantime, I've rolled a patch which will simple change the displayed language to be less confusing as proposed by the author. "Display a specified number of items" will now show "All items" if the value is set to 0 versus "0 items"

My solution was just to check $this->options['items_per_page'] for a "0" value and return the appropriate language.

Here's the code change within the class views_plugin_pager_some extends views_plugin_pager inside views_plugin_pager_some.inc:

    if ($this->options['items_per_page'] == 0) {
      return t('All items');
    }

Tested on a live installation and everything seems to work as expected.

Ignigena’s picture

Status: Active » Needs review

Status: Needs review » Needs work
Issue tags: -Novice

The last submitted patch, pagerallitems-1817442-2.patch, failed testing.

Ignigena’s picture

Status: Needs work » Needs review
Issue tags: +Novice

#2: pagerallitems-1817442-2.patch queued for re-testing.

lyricnz’s picture

Status: Needs review » Needs work

If you want to make this change, you should make it for all relevant pagers (full, mini, some).

lyricnz’s picture

The patch should also handle pagers with offsets properly - emitting 'All items, skip @skip'

lyricnz’s picture

Version: 7.x-3.5 » 7.x-3.x-dev

Actually, since all four pagers use the same logic, it may be cleaner to add a utility method, then call it from each. However, in order to preserve full translate-ability that would mean dynamically constructing the string to be translated, which is probably bad for discoverability.

lyricnz’s picture

Status: Needs work » Needs review
FileSize
3.62 KB

Here's a patch that provides "All Items" messages on full/mini/some pagers. The changes for each look like (ignoring whitespace):

   function summary_title() {
     if (!empty($this->options['offset'])) {
+      if (!empty($this->options['items_per_page'])) {
         return format_plural($this->options['items_per_page'], '@count item, skip @skip', '@count items, skip @skip', array('@count' => $this->options['items_per_page'], '@ski
       }
+      return t('All items, skip @skip', array('@skip' => $this->options['offset']));
+    }
+    if (!empty($this->options['items_per_page'])) {
       return format_plural($this->options['items_per_page'], '@count item', '@count items', array('@count' => $this->options['items_per_page']));
     }
+    return t('All items');
+  }
codi’s picture

Status: Needs review » Reviewed & tested by the community

Applied to HEAD and works as described!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: 1817442-pager-all-items.patch, failed testing.

dandaman’s picture

Assigned: Unassigned » dandaman
Issue summary: View changes
dandaman’s picture

Assigned: dandaman » Unassigned
FileSize
3.88 KB

Re-rolled the patch with the current path of the Views plugins.

dandaman’s picture

Status: Needs work » Needs review
Chris Matthews’s picture

Status: Needs review » Needs work

The views path is now: views/plugins/...

elaman’s picture

Status: Needs work » Needs review
FileSize
4.05 KB
7.14 KB

@chris-matthews re-rolled the patch, based on your comment.

Akanksha92’s picture

@elaman the patch looks good. The patch applied to the module successfully. Please find the attached screenshot for the same.