You are here

function theme_search_api_glossary_facetapi_link_inactive_v2 in Search API AZ Glossary 7.3

Same name and namespace in other branches
  1. 7.2 search_api_glossary.theme.inc \theme_search_api_glossary_facetapi_link_inactive_v2()

Returns HTML for an inactive facet item.

Parameters

$variables: An associative array containing the keys 'text', 'path', 'options', and 'count'. See the l() and theme_facetapi_count() functions for information about these variables.

File

./search_api_glossary.theme.inc, line 14

Code

function theme_search_api_glossary_facetapi_link_inactive_v2($variables) {

  // Builds accessible markup.
  // @see http://drupal.org/node/1316580
  $accessible_vars = array(
    'text' => $variables['text'],
    'active' => FALSE,
  );
  $accessible_markup = theme('facetapi_accessible_markup', $accessible_vars);

  // Sanitizes the link text if necessary.
  $sanitize = empty($variables['options']['html']);
  $variables['text'] = $sanitize ? check_plain($variables['text']) : $variables['text'];

  // Adds count to link if one was passed.
  if ($variables['display_count'] == 1) {
    $variables['text'] .= ' ' . theme('facetapi_count', $variables);
  }

  // Resets link text, sets to options to HTML since we already sanitized the
  // link text and are providing additional markup for accessibility.
  $variables['text'] .= $accessible_markup;
  $variables['options']['html'] = TRUE;
  if ($variables['count'] != 0) {

    // we have some results, hyperlink
    $output = theme_link($variables);
  }
  else {

    // do not hyperlink if there are zero results
    $output = $variables['text'];
  }
  return $output;
}