Since the introduction of pager_settings this settings are not stored.

To reproduce:

  1. Create a view
  2. Change the pager settings, for example the items per page
  3. Export it/change the pager settings again, and you will see that nothing changed

Bug was found by dagmar1

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dagmar’s picture

Status: Active » Needs review
FileSize
1.03 KB

The problem was that views_display_plugin::option_definition was defining the 'items_per_page' (this should be removed in pluggable pagers patch) so, when init() function called $this->get_option('items_per_page') the default value was loaded and not the defined values from UI.

merlinofchaos’s picture

Hm. I think this can't be removed, because otherwise old format stuff will not be properly converted. Instead we must add 'export' => FALSE to these lines. It should be really easy to test this, but I'm pretty sure I had to leave those definitions to make sure that the data would be read properly.

dagmar’s picture

FileSize
1.91 KB

Yes it make sense. So, only perform the conversion if the items_per_page, offset, or use_pager doesn't contains default values.

dagmar’s picture

Issue tags: +alpha-2 blocker

tagging

dawehner’s picture

Status: Needs review » Needs work

Sry, but this patch doesn't fix this for me :(

dagmar’s picture

Status: Needs work » Needs review
FileSize
1.94 KB

Yes, you was right, I only tested it with a default display, but when I click override this doesn't work anymore. New patch, here is my view export, it seems to be working fine now.

$view = new view;
$view->name = 'test1';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Defaults */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '30';
$handler->display->display_options['pager']['options']['offset'] = '';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Field: Nodo: Nid */
$handler->display->display_options['fields']['nid']['id'] = 'nid';
$handler->display->display_options['fields']['nid']['table'] = 'node';
$handler->display->display_options['fields']['nid']['field'] = 'nid';
$handler->display->display_options['fields']['nid']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['nid']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['nid']['alter']['trim'] = 0;
$handler->display->display_options['fields']['nid']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['nid']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['nid']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['nid']['alter']['html'] = 0;
$handler->display->display_options['fields']['nid']['hide_empty'] = 0;
$handler->display->display_options['fields']['nid']['empty_zero'] = 0;
$handler->display->display_options['fields']['nid']['link_to_node'] = 0;

/* Display: Página */
$handler = $view->new_display('page', 'Página', 'page_1');
$handler->display->display_options['defaults']['pager'] = FALSE;
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '25';
$handler->display->display_options['pager']['options']['offset'] = '';
$handler->display->display_options['pager']['options']['id'] = '0';
$handler->display->display_options['path'] = 'test1';
dawehner’s picture

Status: Needs review » Needs work

I just testet a bit. I still does not store / change the pager settings.

I'm using DRUPAL-6--3

figover’s picture

Plz exmplain the issue.
" 1. Create a view
2. Change the pager settings, for example the items per page
3. Export it/change the pager settings again, and you will see that nothing changed
"

Did u save the view after changing pager settings ?

dagmar’s picture

Priority: Normal » Critical

@figover, dereine is the comaintainer of views for Drupal 7, he knows what is he doing :)

@dereine, I'm changing the status of this issue to critical because we need this fixed to test

#324092: Expose: Items per page and Offset
#268023: Limiting total number of items....

Can you provide a more detailed information the steps to reproduce the bug?

I'm doing this:

Apply the patch.
Create a view:
Set Pager -> Full pager, settings changed
Create a new display
Override
Set Pager -> Mini pager, settings changed

And it is working fine... this is weird

dawehner’s picture

git reset
patch apply
edit frontpage view
- it does not work
add new view
- it does store the changed settings.

dagmar’s picture

Status: Needs work » Needs review
FileSize
2.34 KB

The good thing is we have ultra tested this issue :)

So I finally can replicate, when a views was saved with previous values, like Views Bulk Operations with admin/content/node2 contains a value different to 10 as items per page, so it is not the default value. When the view is edited views_plugin_display::init() converts the old values into a new plugin pager, but, items_per_page, offset and use_pager are still here. So when the views is saved, both, new and old values are saved, but then. Views is initialized again, and since old values are still there, pager is loaded as a conversion of the old values.

Solution?

+      // Unset the previous options
+      // After edit and save the view they will be erased
+      $this->set_option('items_per_page', NULL);
+      $this->set_option('offset', NULL);
+      $this->set_option('use_pager', NULL);
dawehner’s picture

Status: Needs review » Reviewed & tested by the community

juhuu this patch works now :)

bwynants’s picture

works like a charm! thanks!

dawehner’s picture

Here is a simpletest for it. There are still two failies, but quite some stuff works.

merlinofchaos’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Ok, tests (even with fails) and patch committed to 6.x; needs to be rerolled for 7.x -- note that I added a missing comma in the patch in an array().

merlinofchaos’s picture

Issue tags: -alpha-2 blocker

untag

dawehner’s picture

dawehner’s picture

Status: Patch (to be ported) » Fixed

i included this patch, too, because this fixes really a lot of bugs.

Status: Fixed » Closed (fixed)

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