Thanks for your quick responses danielb! I love this module and I'm really excited to use it on my latest project.

One more quick bug I found in the latest version. The views are truncated to 10 items no matter what the pager value is set to.

CommentFileSizeAuthor
#9 finder_views.module.patch553 bytescchan

Comments

marcrobinsone’s picture

@chromix, thanks for posting this one.

I also encounter this issue under the following circumstances:
* Finder results pager set to 0 (hoping to control the pager via views 2)
* Setting the views pager does not override the Finder results pager, and instead defaults to 10 items in the search results.

I don't know if getting this fixed will conflict with views or the core Finder results code.

chromix’s picture

@marcrobinsone

It looks like Finder isn't properly setting the items_per_page but I can't seem to figure out why. All I can see is that 10 is the default set for 'items_per_page' in 'views_plugin_display.inc'.

danielb’s picture

I think I understand the problem, it has to do with how finder_views passes on the query results to the results output functions, but I'll need to play around with it a bit to see what works.

danielb’s picture

This problem only affects the case where you're using the 'output display' - it seems to set the output display to 10 despite what you configure it to in views. You are probably right that this default is coming from views_display_plugin.inc - but why isn't it picking up on the settings from views??

chromix’s picture

I should note that even when I try to set the number of nodes manually in the Finder settings (like to "0" let's say) it *still* displays 10 items. In fact, I can't get it to display anything other than 10 items, even when I set the items per page to something like 20 or 30. Very odd...

danielb’s picture

I can get it to display between 1 and 9 items per page by setting the finder's pager. It's number higher than 10, and 0, that don't work for me.

danielb’s picture

I'm attempting to get some advice about this from the Views issue queue http://drupal.org/node/541296

It would be easy for me to force the finder's pager onto the output display - but I think it would be better if it used the settings from the views UI.

cchan’s picture

subscribing.

cchan’s picture

StatusFileSize
new553 bytes

I found a fix for this problem. The issue was in the modules/finder_views.module finder_views_finder_result function which functions properly except for when there are overrides to the default view. When creating a view, it's necessary to call the function view::preview() or view::execute_display(). See views issue #279925: views and custom_pagers works strange (view->execute) for more information.

I simply added $view->preview() to the end of the function and it works on my test instance. Snippet of the code:

function finder_views_finder_result($finder, $keywords, $results, $form_state) {
  $output = '';
  if ($results) {
    if ($finder->settings['views']['results']) {
      $output .= theme('finder_views_results', $results);
    }
    else {
      $args = array();
      $view = views_get_view($finder->settings['views']['view']);
      $display_id = 'default';
      $view->set_display($display_id);
      $view->set_arguments($args);
      $view->is_cacheable = FALSE;

      // compile ids so that finder_views_views_query_alter() knows what to do
      $ids = array();
      foreach ($results as $result) {
        $ids[] = $result[$result['base_field']];
      }
      $view->finder_ids = $ids;

      // Call $view->preview to apply all of the new settings to the view before rendering.
      $view->preview();
      $output .= $view->render($display_id);
    }
  }
  return $output;
}

I tried it on other finder views and wasn't able to find any errors, so hopefully this works. I have attached a patch, so it'd be great if someone could try it out. Hope this works.

danielb’s picture

oh cool

danielb’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.