You are here

public static function PathBreadcrumbsUIAutocomplete::processResultData in Path Breadcrumbs 7.3

1 call to PathBreadcrumbsUIAutocomplete::processResultData()
PathBreadcrumbsUIAutocomplete::processAutocomplete in path_breadcrumbs_ui/includes/path_breadcrumbs_ui.autocomplete.inc

File

path_breadcrumbs_ui/includes/path_breadcrumbs_ui.autocomplete.inc, line 146
Path breadcrumbs UI autocomplete.

Class

PathBreadcrumbsUIAutocomplete
@file Path breadcrumbs UI autocomplete.

Code

public static function processResultData($result, $last_selector, $string) {
  $matches = array();
  foreach ($result as $selector => $info) {

    // If we have an uncomplete last part, take it into account now.
    $attributes = array();
    if (!$last_selector || strpos($selector, $string) === 0) {
      $attributes['class'][] = 'token-normal';
      $attributes['title'] = isset($info['description']) ? strip_tags($info['description']) : '';
      if ($selector[strlen($selector) - 1] == ':') {
        $attributes['class'][] = 'token-expandable';
        $text = check_plain($selector) . '... (' . check_plain($info['label']) . ')';
      }
      else {
        $text = check_plain($selector) . ' (' . check_plain($info['label']) . ')';
      }
      $selector_sign = isset($info['selector_sign']) ? $info['selector_sign'] : '%';
      $matches[$selector_sign . $selector] = "<div" . drupal_attributes($attributes) . ">{$selector_sign}{$text}</div";
    }
  }
  return $matches;
}