You are here

function finder_ajax in Finder 7

Same name and namespace in other branches
  1. 7.2 finder.module \finder_ajax()

Menu callback; get finder ajax output.

Parameters

$finder_id: The finder ID.

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

$path: Any number of additional params to pass to $_GET['q'].

Return value

Finder ajax output.

1 string reference to 'finder_ajax'
finder_menu in ./finder.module
Implements hook_menu().

File

./finder.module, line 644
The finder module.

Code

function finder_ajax($finder_id, $display) {
  if ($finder_id) {
    $finder = finder_load($finder_id);
    if ($finder) {

      // fix the path for any scripts that might call $_GET['q']
      $path = func_get_args();
      array_shift($path);
      array_shift($path);
      $_GET['q'] = implode('/', $path);

      // force the json'd finder output to hide_args
      $finder->settings['advanced']['hide_args'] = 1;
      drupal_json_output(array(
        'status' => TRUE,
        'data' => finder_view($finder, $display, TRUE),
      ));
      exit;
    }
  }
  drupal_json_output(array(
    'data' => '',
  ));
  exit;
}