Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
It stumped me for a while, but views that I was inserting, that had pagers, were overriding the default search pager. I eventually added code into a custom module to prevent them from being inserted on search pages. This is my code below, but any improvements or suggestions are welcome.
function MODULENAME_node_load($nodes, $types) {
if(arg(0) == 'search' && arg(1) == 'node') {
foreach($nodes as $key => $node) {
if(isset($nodes[$key]->body['und'][0]['value'])) {
$nodes[$key]->body['und'][0]['value'] = preg_replace('/\[view:[^\]]*\]/', '' , $nodes[$key]->body['und'][0]['value']);
}
}
}
}
I'm not sure if there should be some change in the module to do this better either. Feel free to close this issue if not.
Comments
Comment #1
Pasqualleyou can have multiple pagers on the same page, just change the pager id on the view edit page
Pager ID description:
this is not a bug in insert_view, it is how multiple pagers work..
Comment #2
burgs CreditAttribution: burgs commentedThanks Pasqualle,
The optimal solution would be to set the search pager to be the second pager, so that all the inserted views pagers didn't have to be. Search isn't that flexible though. Anyway, the slight hack is there for people who need it.