Hi guys,

I recently received this error when exposing the amount of items to display (pager settings) to the user. I had set the amounts to 5, 25, 50, etc, in the "Exposed items per page options", but the amount in "Items per page" was 20. In short, Views wasn't happy that the Items per page wasn't a number in the "Exposed items per page options", but the error message "Please insert the items per page (20) from above." doesn't mane a whole lot of sense, because the message is displayed at the top of the panel. I would consider changing this to something like, "Please ensure the 'Items per page' value is the same as a value in 'Exposed items per page options'".

Thanks again for such an awesome module :)

Josh

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bojhan’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.5 » 8.x-dev
Component: User interface » views_ui.module
Issue summary: View changes
Issue tags: +Usability

Yup, this is a freaky error message.

magunz’s picture

I've changed it to "You must have your current items per page (10) as an opition on your exposed items per page."
as per attached patch

magunz’s picture

Status: Active » Needs review
Issue tags: +#Drupal8nz

This patch is part of the 24 March 2014 Drupal 8 codes print New Zealand event.

wiifm’s picture

Status: Needs review » Reviewed & tested by the community

This is a solid improvement over the existing confusing error message in views. I am definitely in favour of getting this committed. This may also be a candidate for back porting if this error message is in the D7 version of views too.

webchick’s picture

Component: views_ui.module » user interface text
Status: Reviewed & tested by the community » Needs work
Issue tags: +VDC

Small typo: "opition"

The error message also seems a bit verbose vs. our current standards (tagging to get the UX team to chime in), and when I got it, I wasn't exactly sure how to fix it, because the field that's wrong isn't identified except if you scroll down and see a red outline. Suggest something like:

"The Exposed items per page field's options must include the value from the Items per page field (@num)."

(Note: I can't remember if we italicize field names like that, but hopefully the UX team knows.)

I'm also wondering if we can scope-creep this slightly to include 50 in the default list of options? Because right now you will ALWAYS get this error message if you check "Expose items per page" because "Items per page" defaults to 50, and "Exposed items per page options*" defaults to "5, 10, 20, 40, 60."

wiifm’s picture

Status: Needs work » Needs review
FileSize
11.78 KB

Changes in this patch:

  • Changed the text to match @webchick's advice
  • Performed a recursive find and replace across the codebase to make items per page include 50
LinL’s picture

6: 1870866-6.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 6: 1870866-6.patch, failed testing.

dawehner’s picture

+++ b/core/modules/aggregator/config/views.view.aggregator_rss_feed.yml
@@ -48,7 +48,7 @@ display:
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml

diff --git a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml
index c2de92e..c039c3b 100644

index c2de92e..c039c3b 100644
--- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml

--- a/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml
+++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml

+++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml
+++ b/core/modules/comment/tests/modules/comment_test_views/test_views/views.view.test_comment_row.yml
@@ -52,7 +52,7 @@ display:

@@ -52,7 +52,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml b/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml

diff --git a/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml b/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml
index e060a63..953676e 100644

index e060a63..953676e 100644
--- a/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml

--- a/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml
+++ b/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml

+++ b/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml
+++ b/core/modules/contact/tests/modules/contact_test_views/test_views/views.view.test_contact_link.yml
@@ -43,7 +43,7 @@ display:

@@ -43,7 +43,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: 5, 10, 20, 40, 60
+            items_per_page_options: 5, 10, 20, 40, 50, 60

index cc7d114..3a58a01 100644
--- a/core/modules/file/config/views.view.files.yml

--- a/core/modules/file/config/views.view.files.yml
+++ b/core/modules/file/config/views.view.files.yml

+++ b/core/modules/file/config/views.view.files.yml
+++ b/core/modules/file/config/views.view.files.yml
@@ -52,7 +52,7 @@ display:

@@ -52,7 +52,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
@@ -722,7 +722,7 @@ display:

@@ -722,7 +722,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/node/config/views.view.archive.yml b/core/modules/node/config/views.view.archive.yml

diff --git a/core/modules/node/config/views.view.archive.yml b/core/modules/node/config/views.view.archive.yml
index 943c220..671f210 100644

index 943c220..671f210 100644
--- a/core/modules/node/config/views.view.archive.yml

--- a/core/modules/node/config/views.view.archive.yml
+++ b/core/modules/node/config/views.view.archive.yml

+++ b/core/modules/node/config/views.view.archive.yml
+++ b/core/modules/node/config/views.view.archive.yml
@@ -49,7 +49,7 @@ display:

@@ -49,7 +49,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/node/config/views.view.frontpage.yml b/core/modules/node/config/views.view.frontpage.yml

diff --git a/core/modules/node/config/views.view.frontpage.yml b/core/modules/node/config/views.view.frontpage.yml
index a6928ab..02522e0 100644

index a6928ab..02522e0 100644
--- a/core/modules/node/config/views.view.frontpage.yml

--- a/core/modules/node/config/views.view.frontpage.yml
+++ b/core/modules/node/config/views.view.frontpage.yml

+++ b/core/modules/node/config/views.view.frontpage.yml
+++ b/core/modules/node/config/views.view.frontpage.yml
@@ -120,7 +120,7 @@ display:

@@ -120,7 +120,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/node/config/views.view.glossary.yml b/core/modules/node/config/views.view.glossary.yml

diff --git a/core/modules/node/config/views.view.glossary.yml b/core/modules/node/config/views.view.glossary.yml
index 03a7a18..5466d84 100644

index 03a7a18..5466d84 100644
--- a/core/modules/node/config/views.view.glossary.yml

--- a/core/modules/node/config/views.view.glossary.yml
+++ b/core/modules/node/config/views.view.glossary.yml

+++ b/core/modules/node/config/views.view.glossary.yml
+++ b/core/modules/node/config/views.view.glossary.yml
@@ -49,7 +49,7 @@ display:

@@ -49,7 +49,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml

diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml
index fbb49e3..ab24785 100644

index fbb49e3..ab24785 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml

--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml

+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_contextual_links.yml
@@ -23,7 +23,7 @@ display:

@@ -23,7 +23,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: '0'
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml

diff --git a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml
index ed25f0c..d1d80a9 100644

index ed25f0c..d1d80a9 100644
--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml

--- a/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml

+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml
+++ b/core/modules/node/tests/modules/node_test_views/test_views/views.view.test_node_view.yml
@@ -52,7 +52,7 @@ display:

@@ -52,7 +52,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: '0'
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/taxonomy/config/views.view.taxonomy_term.yml b/core/modules/taxonomy/config/views.view.taxonomy_term.yml

diff --git a/core/modules/taxonomy/config/views.view.taxonomy_term.yml b/core/modules/taxonomy/config/views.view.taxonomy_term.yml
index 6477894..182fccb 100644

index 6477894..182fccb 100644
--- a/core/modules/taxonomy/config/views.view.taxonomy_term.yml

--- a/core/modules/taxonomy/config/views.view.taxonomy_term.yml
+++ b/core/modules/taxonomy/config/views.view.taxonomy_term.yml

+++ b/core/modules/taxonomy/config/views.view.taxonomy_term.yml
+++ b/core/modules/taxonomy/config/views.view.taxonomy_term.yml
@@ -48,7 +48,7 @@ display:

@@ -48,7 +48,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
@@ -211,7 +211,7 @@ display:

@@ -211,7 +211,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml

diff --git a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
index b44debb..dda388b 100644

index b44debb..dda388b 100644
--- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml

--- a/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
+++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml

+++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
+++ b/core/modules/taxonomy/tests/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml
@@ -45,7 +45,7 @@ display:

@@ -45,7 +45,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: 0
diff --git a/core/modules/user/config/views.view.user_admin_people.yml b/core/modules/user/config/views.view.user_admin_people.yml

diff --git a/core/modules/user/config/views.view.user_admin_people.yml b/core/modules/user/config/views.view.user_admin_people.yml
index 89d1e4e..d59fc23 100644

index 89d1e4e..d59fc23 100644
--- a/core/modules/user/config/views.view.user_admin_people.yml

--- a/core/modules/user/config/views.view.user_admin_people.yml
+++ b/core/modules/user/config/views.view.user_admin_people.yml

+++ b/core/modules/user/config/views.view.user_admin_people.yml
+++ b/core/modules/user/config/views.view.user_admin_people.yml
@@ -53,7 +53,7 @@ display:

@@ -53,7 +53,7 @@ display:
           expose:
             items_per_page: false
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: false
             items_per_page_options_all_label: '- All -'
             offset: false
diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php

diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php
index a0c1c3d..58641f0 100644

index a0c1c3d..58641f0 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php

--- a/core/modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php

+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/SqlBase.php
@@ -22,7 +22,7 @@ protected function defineOptions() {

@@ -22,7 +22,7 @@ protected function defineOptions() {
       'contains' => array(
         'items_per_page' => array('default' => FALSE, 'bool' => TRUE),
         'items_per_page_label' => array('default' => 'Items per page', 'translatable' => TRUE),
-        'items_per_page_options' => array('default' => '5, 10, 20, 40, 60'),
+        'items_per_page_options' => array('default' => '5, 10, 20, 40, 50, 60'),
         'items_per_page_options_all' => array('default' => FALSE, 'bool' => TRUE),
         'items_per_page_options_all_label' => array('default' => '- All -', 'translatable' => TRUE),
 
@@ -202,7 +202,7 @@ public function validateOptionsForm(&$form, &$form_state) {

+++ b/core/modules/views/tests/modules/views_test_config/test_views/views.view.test_mini_pager.yml
@@ -32,7 +32,7 @@ display:
           expose:
             items_per_page: '0'
             items_per_page_label: 'Items per page'
-            items_per_page_options: '5, 10, 20, 40, 60'
+            items_per_page_options: '5, 10, 20, 40, 50, 60'
             items_per_page_options_all: '0'
             items_per_page_options_all_label: '- All -'

I don't get those changes. 5, 5, 20, 10, 10 as step size makes absolutely no sense. I guess we should change the actual default value in the code as well, if we want to change them.

wiifm’s picture

Assigned: Unassigned » wiifm

Assigning to myself to get a new patch up.

wiifm’s picture

Assigned: wiifm » Unassigned
Status: Needs work » Needs review
FileSize
11.92 KB

So I did a bit of research as to the most popular items per page at the moment in the code base:

grep -rI "items_per_page:" | awk '{print $3}'| tr -d "'" | sort -n
0
0
0
0
0
0
false
false
false
false
false
false
false
false
false
false
false
false
false
false
false
true
1
2
3
5
5
5
5
5
5
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
15
25
25
25
25
25
25
25
25
25
25
25
30
30
36
50
50
50
50

Based on this, I made the assumption that the items per page should be

5, 10, 25, 50 (leaving gaps of 5, 5, 15, 25 which should make more sense).

Patch attached that does this. Patch was made with sed

find . -type f -print0 | xargs -0 sed -i "s/'5, 10, 20, 40, 60'/'5, 10, 25, 50'/g"

Also have brought forward the message change.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

I really like this more logarithmic based items per page.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 0fe89b3 and pushed to 8.0.x. Thanks!

  • alexpott committed 0fe89b3 on 8.0.x
    Issue #1870866 by wiifm, magunz | jfarry: Fixed "Please insert the items...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.