- Issue created by @murilohp
- Status changed to Needs review
over 1 year ago 8:34pm 12 July 2023 - last update
over 1 year ago 2 pass
Hi! I'm working on a feature where I need to change the "Load more items" button URL, I don't know if I'm doing it the best way but right now it's working properly. Just for you know, I have a custom module with the following snippet implemented:
/**
* Implements hook_preprocess_views_infinite_scroll_pager().
*/
function my_custom_module_preprocess_views_infinite_scroll_pager(&$vars) {
$vars['items']['next']['href'] = Url::fromRoute('/custom-path');
}
The only problem is, my custom hook is being executed before the views_infinite_scroll_preprocess_views_infinite_scroll_pager
so every time, my custom URL is being rewritten, and I couldn't find any way to change the preprocess hook order(if you know how to do it, please tell me, I've tried to use the hook_module_implements_alter
hook, but it's not working)
Change the views_infinite_scroll_preprocess_views_infinite_scroll_pager
to change the URL only if the $vars['items']['next']['href']
is empty
Needs review
2.0
Code