You are here

function theme_facetapi_link_inactive in Facet API 7

Same name and namespace in other branches
  1. 6.3 facetapi.theme.inc \theme_facetapi_link_inactive()
  2. 6 facetapi.theme.inc \theme_facetapi_link_inactive()
  3. 7.2 facetapi.theme.inc \theme_facetapi_link_inactive()

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

./facetapi.theme.inc, line 45
Theme functions for the Facet API module.

Code

function theme_facetapi_link_inactive($variables) {

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

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

  // Zero elements. Make non-clickable element.
  if (isset($variables['count']) && $variables['count'] == 0) {
    $variables['element'] = array(
      '#value' => $text,
      '#tag' => 'span',
      '#attributes' => $variables['options']['attributes'],
    );
    return theme('html_tag', $variables);
  }
  else {

    // 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);

    // Resets link text, sets to options to HTML since we already sanitized the
    // link text and are providing additional markup for accessibility.
    $variables['text'] = $text . $accessible_markup;
    $variables['options']['html'] = TRUE;
    return l($variables['text'], $variables['path'], $variables['options']);
  }
}