I want users to be presented with something like "No match found. Would you like to create a new record?" and give them an appropriate link if there is no match for the search string. Is this possible currently? If not, any ideas on how to implement something like it?

Comments

fuquam’s picture

subscribing.

It looks like that will be an option with the Finder Wizard but its not implemented yet.

danielb’s picture

You could do this simply by overriding theme_finder_results and instead of printing out 'There are no results to display' you would do whatever you need.
http://drupal.org/node/477136

Otherwise it is possible via finder's hooks, you'd just need to find the right place to do it.

danielb’s picture

Title: if there is no search match can i redirect to node » Configuration for 'no results' text.

I am considering changing the 'no results to display' text from being hardcoded in the theme function, to being a configurable textarea with formatting options.

gotobedsleepyhead’s picture

That would be a useful addition. I guess I'm going to have to learn a bit more about theming to get exactly what I want...

I want the inputted search string to be inserted into the title of a new content element. I have the prepopulate extension installed, so all i need to know is how so to grab the finders text fields' value.

/**
* Theme the finder results.
*/
function garland_finder_results($results, $finder, $keywords, $per_page, $params, $form_state, $?????????) {
  $output = '';
  //$output .= '<h3 class="finder-results">'. t('Results') .'</h3>';
  $output .= '<div class="finder-results">';
  if ($results) {
    $output .= $results;
    if ($per_page) {
      $output .= theme('pager', NULL, $per_page, 0, $params);
    }
  }
  else {
    $output .= 'No result! <a href= "/node/add/newrecord?edit[title]='. $????????? .'">Make new report</a>';
	}
  $output .= '</div>';
  return $output;
}
danielb’s picture

$keywords is an array structure that holds this data. The keywords are keyed by the id of the finder element, and a keyword can also actually be an array of keywords, so watch for that. The information is also in $form_state somewhere if you care to dig around.

gotobedsleepyhead’s picture

That worked, thanks for the great module.

danielb’s picture

Status: Active » Fixed

I've added a config to be able to do this too. Kinda.

Status: Fixed » Closed (fixed)

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

Sinan Erdem’s picture

Status: Closed (fixed) » Active

I've added a config to be able to do this too. Kinda.

Sorry to re-open this issue, but I couldn't find the config page for this. I want to translate this string to other languages. If not possible. I simply want to change in into another string.

Thanks...

danielb’s picture

Status: Active » Fixed

In the finder go to "Advanced" -> "No Results Output"
It is possible to translate with finder_i18nstrings.

This is not a support issue.

Status: Fixed » Closed (fixed)

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