You are here

function freelinking_search_callback in Freelinking 7.3

Same name and namespace in other branches
  1. 6.3 plugins/freelinking_search.inc \freelinking_search_callback()

Builds a link to search for something

Return value

an array to build the link.

1 string reference to 'freelinking_search_callback'
freelinking_search.inc in plugins/freelinking_search.inc

File

plugins/freelinking_search.inc, line 29

Code

function freelinking_search_callback($target, $plugin) {
  global $base_url;
  $link = array();
  $failover = variable_get('freelinking_search_failover', 'error');
  if (!module_exists('search')) {
    if ($failover == 'error') {

      // send back an error message.
      return array(
        'failover' => 'error',
        'message' => t('Search Unavailable'),
      );
    }
    else {

      // specify a plugin for next effort
      $target['other']['site'] = $base_url;
      return array(
        'failover' => $failover,
        'target' => $target,
      );
    }
  }
  $link[0] = $target['text'] ? $target['text'] : $target['target'];
  $link[1] = 'search/node/' . $target['dest'];
  $link[2]['attributes']['title'] = t($plugin['tip'], array(
    '%dest' => $target['target'],
  ));
  return $link;
}