ksenzee/views3ui

allow to insert 0 as items per page

Closed this issue · 5 comments

It's a perfect legal use case to insert 0 as items per page.

Is there any reason why this was added?

PS: commited already a fix into git.

... reported by Aspilicious

No, the pager to do a limited number of items is different from the pager to do all items, partly because SQL doesn't allow us to do an offset with all items. So the 'some' pager isn't supposed to accept 0 as a limit.

Okay this makes sense, but
shouldn't 0 then lead to "display all items" pager plugin?

Since the "add new view wizard" functionality isn't supposed to hit all use cases but rather only the most common ones, it doesn't seem like a huge problem to me if you can't create a view with unlimited items per page from there - since you can always go in and configure it to do that later, right? I think it would be a bit counterintuitive to type "0" for unlimited on that screen (without any explanation) though I guess it doesn't hurt much to leave it as a backdoor option for people who already know about it.

Either way, if http://drupalcode.org/project/views.git/commit/246ee7a is the commit you're referring to, it looks like it has some mistakes:

  1. The wizard has two "items per page" selectors (one for the page, one for the block) but it looks like your commit removed validation from only one of them. They should be kept in sync.
  2. Even if we allow 0 as an option, we don't want to remove the validation altogether. It's still the case that it needs to be a non-negative integer, right? :) So in that case it should be replaced with a different validation function.

Finally this was reverted/

It doesn't make sense to support such a uncommon use case in the wizard