Return last searched value, example as argument

nimek - April 23, 2009 - 17:51
Project:Autocomplete Node Finder
Version:5.x-3.9
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

That future imo is missing cause ANF works great but it doesent returns searched value so you can put title in result page in that form:

"Result page for "

This is value is also needed if you want display in search field last searched value

#1

danielb - April 24, 2009 - 04:15
Status:active» fixed

This is a theming issue, you have full control of the output via this theme function:

/**
* Build a basic results page.
*/

function theme_autocomplete_node_finder_results_page($delta, $nids, $form_values) {
  global $pager_page_array, $pager_total, $pager_total_items;
  $limit = variable_get('autocomplete_node_finder_'.$delta.'_pager', 0);

  if (!empty($nids) && is_numeric($limit) && $limit > 0) {
    $total = count($nids);
    $nids = array_chunk($nids, $limit, TRUE);
    $page = isset($_GET['page']) ? $_GET['page'] : 0;
    $nids = $nids[$page];
    $quantity = ceil($total/$limit);

    // set globals for theme_pager
    $pager_total_items[$delta] = $total;
    $pager_total[$delta] = $quantity;
    $pager_page_array[$delta] = $page;
  }

  $output = '';

  if (empty($nids)) {
    $output .= t('There are no results to display.');
  }
  else {
    foreach ($nids as $nid) {
      $result = node_load($nid);
      $output .= node_view($result, TRUE);
    }
  }

  if (is_numeric($limit) && $limit > 0) {
    $output .= theme('pager', null, $limit, $delta, array(), $quantity);
  }

  return $output;
}

You are able to access the $form_values here and do what you want. Including calls to 'drupal_set_title' or just outputting HTML headings.

The reason this is not done by default is because you can create some pretty complicated filters using appendages, in which case the output for the title might be awkward.

#2

System Message - May 8, 2009 - 04:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.