You are here

protected function Vocabulary::checkTermThreshold 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::checkTermThreshold()

Checks the threshold count for a term.

Parameters

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

1 call to Vocabulary::checkTermThreshold()
Vocabulary::buildSitemapTerm in src/Plugin/Sitemap/Vocabulary.php
Builds a taxonomy term item.

File

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

Class

Vocabulary
Provides a sitemap for an taxonomy vocabulary.

Namespace

Drupal\sitemap\Plugin\Sitemap

Code

protected function checkTermThreshold(&$term) {
  if (!isset($term->display)) {
    $term->display = FALSE;
  }
  $threshold = $this->settings['term_count_threshold'];
  $showCount = $this->settings['show_count'];
  $term->count = sitemap_taxonomy_term_count_nodes($term->tid);
  if ($threshold || $showCount) {
    if ($threshold && !isset($term->hasChildren)) {
      if ($term->count >= $threshold) {
        $term->display = TRUE;
      }
    }
    else {
      $term->display = TRUE;
    }
  }
  else {
    $term->display = TRUE;
  }
}