You are here

function finder_view in Finder 6

Same name and namespace in other branches
  1. 7 finder.module \finder_view()

Generate display of a given finder.

Parameters

$finder: The finder object to generate the output for.

$display: The type of display ('page', or 'block').

$ahah: Whether in the context of an AHAH request.

Return value

Themed output of a finder.

5 calls to finder_view()
finder_ahah in ./finder.module
Menu callback; get finder ahah output.
theme_finder_block in includes/finder.inc
Theme the finder block wrapper.
theme_finder_block in includes/finder.theme.inc
Theme the finder block wrapper.
theme_finder_page in includes/finder.inc
Theme the finder page wrapper.
theme_finder_page in includes/finder.theme.inc
Theme the finder page wrapper.
1 string reference to 'finder_view'
finder_i18nstrings_finderapi in modules/finder_i18nstrings/finder_i18nstrings.module
Implementation of hook_finderapi().

File

./finder.module, line 582
The finder module.

Code

function finder_view($finder, $display, $ahah = FALSE) {
  finder_inc('form');
  finder_invoke_finderapi($finder, 'finder_view', $display);
  $output = array();
  $finder->finder_view_build_id = 'finder-' . $display . '-' . $finder->finder_id . '-wrapper';
  $finder->finder_view_build_display = $display;

  // Always get the form in order to populate the form_state in case there are results we need to present.
  // The form building function will not spend resources building elements if it doesn't need to.
  // to do: this non form_on_page get_form may only be needed when hiding url args?
  $form = drupal_get_form('finder_form_' . $finder->finder_id, $finder);
  if ($finder->settings['advanced']['show_admin_links'] && user_access('administer finder')) {
    $output['admin_links'] = theme('finder_admin_links', $finder);
  }
  if ($display != 'page' || $display == 'page' && $finder->settings['form_on_page']) {
    $output['form'] = $form;
  }
  if ($finder->settings['advanced']['show_links']) {
    $output['links'] = theme('finder_links', $finder);
  }
  if ($display != 'block' || $display == 'block' && $ahah) {
    $output['results'] = finder_results($finder);
  }
  $rendered = '';
  $rendered .= $ahah ? '' : '<div id="' . $finder->finder_view_build_id . '" class="finder-view-wrapper">';
  $rendered .= theme('finder_view', $finder, $display, $output);
  $rendered .= $ahah ? '' : '</div>';
  return $rendered;
}