You are here

public function SearchApiViewsHandlerArgumentTaxonomyTerm::title in Search API 7

Get the title this argument will assign the view, given the argument.

Overrides views_handler_argument::title

File

contrib/search_api_views/includes/handler_argument_taxonomy_term.inc, line 70
Contains the SearchApiViewsHandlerArgumentTaxonomyTerm class.

Class

SearchApiViewsHandlerArgumentTaxonomyTerm
Defines a contextual filter searching through all indexed taxonomy fields.

Code

public function title() {
  if (!empty($this->argument)) {
    if (empty($this->value)) {
      $this
        ->fillValue();
    }
    $terms = array();
    foreach ($this->value as $tid) {
      $taxonomy_term = taxonomy_term_load($tid);
      if ($taxonomy_term) {
        $terms[] = check_plain($taxonomy_term->name);
      }
    }
    return $terms ? implode(', ', $terms) : check_plain($this->argument);
  }
  else {
    return check_plain($this->argument);
  }
}