You are here

public function SiteMapHelper::getTerms in Site map 8

Render the latest maps for the taxonomy tree.

Parameters

object $voc: Vocabulary entity.

Return value

array Returns a renderable array for site map taxonomies.

File

src/SiteMapHelper.php, line 61

Class

SiteMapHelper
Defines a helper class for stuff related to views data.

Namespace

Drupal\site_map

Code

public function getTerms($voc) {
  $output = '';
  $options = array();
  if (\Drupal::moduleHandler()
    ->moduleExists('taxonomy') && !empty($voc)) {

    //@TODO: Test translations in core
    if (\Drupal::moduleHandler()
      ->moduleExists('i18n_taxonomy')) {
      $voc->name = i18n_taxonomy_vocabulary_name($voc, $GLOBALS['language']->language);
    }
    $output = $this
      ->getTaxonomyTree($voc
      ->get('vid'), $voc
      ->get('name'), $voc
      ->get('description'));
    $this
      ->setOption($options, 'show_titles', 1, 'show_titles', TRUE);
  }
  return $output;
}