[support] Related to views pager

Vaibhav Jain in.vaibhavjain at gmail.com
Tue Jan 6 16:08:54 UTC 2015


Hello Everyone,

I am using Drupal 7.34 and Views 7.x-3.8
I have created a view, where I ask views to fetch all results, by selecting
"Display all items" radio button, in "Pager -> Use Pager" section.
I now, alter the query using hook_views_query_alter, and If a condition is
met, I add a condition, and if a condition is not met, I ask the view to
fetch only 1 result.
The else case is causing issues for me.
My code in else case is this -> "$view->set_items_per_page(1);"
I have tried adding $view->init_pager(); as well, but no good.
I am not able to get views fetch only 1 result, if the custom condition in
hook_views_query_alter is not met.
On Debugging, I saw that what views does is defines the "type" of pager.
If "type" is "none", the pager is never called, which is the case, when I
select the option as "Display all items" mentioned above.
If "type" is "some", the pager starts working, as pager is set to some, and
value items_per_page shows its effect.

I believe, If I can find a way to change the "type" property of pager form
"none" to "some", I can crack this.
Any help is appreciated.

Thanks.
Drupal.org Forum Link -> https://www.drupal.org/node/2402617
-- 
Regards,
Vaibhav Jain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20150106/cdbb63b1/attachment.html 


More information about the support mailing list