You are here

function apachesolr_l in Apache Solr Search 8

Same name and namespace in other branches
  1. 5.2 apachesolr.module \apachesolr_l()
  2. 6.3 apachesolr.module \apachesolr_l()
  3. 6 apachesolr.module \apachesolr_l()
  4. 6.2 apachesolr.module \apachesolr_l()
  5. 7 apachesolr.module \apachesolr_l()

A replacement for l()

  • doesn't add the 'active' class
  • retains all $_GET parameters that ApacheSolr may not be aware of
  • if set, $options['query'] MUST be an array

for parameters and options.

Return value

an HTML string containing a link to the given path.

See also

http://api.drupal.org/api/function/l/6

1 call to apachesolr_l()
theme_apachesolr_sort_link in ./apachesolr.module

File

./apachesolr.module, line 2676
Integration with the Apache Solr search application.

Code

function apachesolr_l($text, $path, $options = array()) {

  // Merge in defaults.
  $options += array(
    'attributes' => array(),
    'html' => FALSE,
    'query' => array(),
  );

  // Don't need this, and just to be safe.
  unset($options['attributes']['title']);

  // Retain GET parameters that Apache Solr knows nothing about.
  $get = array_diff_key($_GET, array(
    'q' => 1,
    'page' => 1,
    'solrsort' => 1,
  ), $options['query']);
  $options['query'] += $get;
  return '<a href="' . check_url(url($path, $options)) . '"' . drupal_attributes($options['attributes']) . '>' . ($options['html'] ? $text : check_plain(html_entity_decode($text))) . '</a>';
}