advanced_help_search_view

Versions
5 – 7
advanced_help_search_view()

Page callback for advanced help search.

Code

contrib/advanced_help/advanced_help.module, line 123

<?php
function advanced_help_search_view() {
  if (!module_exists('search')) {
    return MENU_NOT_FOUND;
  }

  $breadcrumb[] = advanced_help_l(t('Help'), 'admin/advanced_help');

  if (!isset($_POST['form_id'])) {
    $keys = search_get_keys();
    // Only perform search if there is non-whitespace search term:
    $results = '';
    if (trim($keys)) {

      // Collect the search results:
      $results = search_data($keys, 'advanced_help');

      if ($results) {
        $results = theme('box', t('Search results'), $results);
      }
      else {
        $results = theme('box', t('Your search yielded no results'), search_help('search#noresults', drupal_help_arg()));
      }
    }

    // Construct the search form.
    $output = drupal_get_form('advanced_help_search_form', $keys);
    $output .= $results;

  }
  else {
    $output = drupal_get_form('advanced_help_search_form', empty($keys) ? '' : $keys);
  }

  $popup = !empty($_GET['popup']) && user_access('view advanced help popup');
  if ($popup) {
    $GLOBALS['devel_shutdown'] = FALSE; // Prevent devel module from spewing.
    module_invoke('admin_menu', 'suppress'); // Suppress admin_menu.
    drupal_set_breadcrumb(array_reverse($breadcrumb));
    print theme('advanced_help_popup', $output);
    return;
  }

  $breadcrumb = array_merge(drupal_get_breadcrumb(), array_reverse($breadcrumb));
  drupal_set_breadcrumb($breadcrumb);
  return $output;
}
?>