You are here

protected function Vocabulary::buildSitemapTerm in Sitemap 2.0.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Sitemap/Vocabulary.php \Drupal\sitemap\Plugin\Sitemap\Vocabulary::buildSitemapTerm()

Builds a taxonomy term item.

Parameters

\stdClass $term: The term object returned by TermStorage::loadTree()

Return value

array|void

2 calls to Vocabulary::buildSitemapTerm()
Vocabulary::buildList in src/Plugin/Sitemap/Vocabulary.php
Builds a tree/list array given a taxonomy term tree object.
Vocabulary::view in src/Plugin/Sitemap/Vocabulary.php
Builds a renderable array for a sitemap item.

File

src/Plugin/Sitemap/Vocabulary.php, line 262

Class

Vocabulary
Provides a sitemap for an taxonomy vocabulary.

Namespace

Drupal\sitemap\Plugin\Sitemap

Code

protected function buildSitemapTerm($term) {
  $this
    ->checkTermThreshold($term);
  if ($term->display) {
    return [
      '#theme' => 'sitemap_taxonomy_term',
      '#name' => $term->name,
      '#url' => $this
        ->buildTermLink($term) ?: '',
      '#show_link' => $this
        ->determineLinkVisibility($term),
      '#show_count' => $this
        ->determineCountVisibility($term),
      '#count' => isset($term->count) ? $term->count : '',
      '#show_feed' => $this->settings['enable_rss'],
      '#feed' => $this
        ->buildFeedLink($term) ?: '',
    ];
  }
}