Say for instance, you have a view that displays when viewing a certain node type, but you want the pager settings to be different for each individual node. I was thinking of making a CCK field like "pager setting" and then give it an integer option of x-y. But I don't know if it's possible to somehow dynamically plug that field into the Views' settings. Or is there another way to do this maybe?
|
The views hook that you would want to use is hook_views_pre_build which is called before the query is build. Now This is assuming you have some basic module development experience and that you are familiar with the views api. You should be able to do :
Above we're using a views hook thats call before the view query is build that way the pager and everything else will reflect the change. Word of cautious views hooks should only be used if you understand whats going on. The above code is written for views-2.x. Hope this helps. |
||||
|
|
You should to use views preprocess function
|
|||
|
|
To update views result and pager in hook_views_pre_render, you can do following:
This should work!! ;) |
|||||
|
|
For Drupal 7, Only should write the following:
In the example:
I use code example by @ericduran. |
||||
|
|