You are here

private function MenuLeaf::getTermUrlAlias in Taxonomy Facets 8

Get taxonomy term url alias from the term object.

Parameters

object: The term object

Return value

string Return url alias

1 call to MenuLeaf::getTermUrlAlias()
MenuLeaf::__construct in src/MenuLeaf.php

File

src/MenuLeaf.php, line 40

Class

MenuLeaf

Namespace

Drupal\taxonomy_facets

Code

private function getTermUrlAlias() {
  $query = db_select('url_alias', 'u')
    ->fields('u', array(
    'alias',
  ))
    ->condition('source', '/taxonomy/term/' . $this->tid)
    ->execute();
  if ($aliases = $query
    ->fetchAll()) {
    $aliases = current($aliases)->alias;
    $this->urlAlias = ltrim($aliases, "/");
  }
  else {
    drupal_set_message(t('You do not have any url aliases generate for taxonomy terms, see Taxonomy Facets module readme file.'), 'warning');
  }
}