How to assign a new icon to a pager?
Question
The current default pager in Views Paging Drupalgap is easily neglected.
Can I assign it a new icon or create my own pager button? Currently, what I know is to put it at the top or the bottom using pager_pos: 'bottom'
, but nothing else.
Solution
Thanks to Tyler. I follow his suggestion and have solved this by adding the theme_pager_link() to app/themes/my_theme/my_theme.js
. Here is what I added:
function my_theme_pager_next(variables) {
try {
var html;
variables.page = parseInt(variables.results.view.page) + 1;
var link_vars = {
text: 'Next Page',
attributes: {
'class': 'pager_next',
'data-icon': 'fast-forward'
}
};
html = theme_pager_link(variables, link_vars);
return html;
}
catch (error) { console.log('my_theme_pager_next - ' + error); }
}
function my_theme_pager_previous(variables) {
try {
var html;
variables.page = parseInt(variables.results.view.page) - 1;
var link_vars = {
text: 'Previous Page',
attributes: {
'class': 'pager_previous',
'data-icon': 'fast-backward'
}
};
html = theme_pager_link(variables, link_vars);
return html;
}
catch (error) { console.log('my_theme_pager_previous - ' + error); }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange