-1

I have a Views page which is a search page based on a Search API index containing a few filters. The results are rendered entities. When clicking one of the entities, I wonder if it is possible reuse the views query on that node page.

Say I only have 23 results by using certain filtering. When I click on one of the results, I want to scroll through the other 22 by using a pager. I have provided images of a non Drupal site that has what I want to achieve.

Possible solutions I can think of are as my title describes. Or create another similar view which only renders 1 entity which is used when clicking on one of the entities from the search results page. I would very much like to hear your input on this.

View settings

Non Drupal site search results and detail page

0

This could be the same view, so not the node page, using a different (page-)display.

You just change the pager to 1 per site and pass the page (querystring argument for the pager) to this next view, where you show the entity in a different view mode (maybe full).

For this you need to alter the node links in the first view. This could be done in hook_views_pre_render. Like:

function MYMODULE_views_pre_render(&$view) {
  if ($view->name == 'NAMEOFTHEVIEW') {
    foreach($view->result as $r => $result) {
      $view->result[$r]->desired_field[][] = 'path/to/view?page=' . $r;
    }
  }
}

This code won't run, it's kind of a hint. You need to debug yourself ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.