I have HTML desing of pagger ,How to I assign my own class to pager in side view ?I dont have any idea about it so will you plese tell how can I ?
-
You could refer to drupal.stackexchange.com/questions/41306/… for your answer.– Nitesh SethiaNov 29, 2013 at 7:59
2 Answers
I believe there are two ways you can do it:-
In template.php , you can use theme_pager. Then overrite it.
You can make a views template and overrite it. For this just goto advance option in views and search for template suggestion.
I could not find a way to add a class to theme_pager()
using the hook_preprocess_HOOK
system, so here is a slightly different template.php
solution that won't involve having to override a core function.
I noticed that views pagers are also run through theme_item_list()
which does allow you to add classes.
function MYTHEME_preprocess_item_list(&$vars) {
$vars['attributes']['class'][] = 'my-class';
}
You can/should add an if condition check to see that the list really is going to be a pager, e.g. use if ($vars['attributes']['class'][0] == 'pager')
or some other identifier to confirm that you're adding the class to a pager ul.