function ForumUninstallValidator::getForumVocabulary

Same name in other branches
  1. 9 core/modules/forum/src/ForumUninstallValidator.php \Drupal\forum\ForumUninstallValidator::getForumVocabulary()
  2. 8.9.x core/modules/forum/src/ForumUninstallValidator.php \Drupal\forum\ForumUninstallValidator::getForumVocabulary()
  3. 11.x core/modules/forum/src/ForumUninstallValidator.php \Drupal\forum\ForumUninstallValidator::getForumVocabulary()

Returns the vocabulary configured for forums.

Return value

\Drupal\taxonomy\VocabularyInterface The vocabulary entity for forums.

1 call to ForumUninstallValidator::getForumVocabulary()
ForumUninstallValidator::validate in core/modules/forum/src/ForumUninstallValidator.php
Determines the reasons a module can not be uninstalled.

File

core/modules/forum/src/ForumUninstallValidator.php, line 120

Class

ForumUninstallValidator
Prevents forum module from being uninstalled under certain conditions.

Namespace

Drupal\forum

Code

protected function getForumVocabulary() {
    $vid = $this->configFactory
        ->get('forum.settings')
        ->get('vocabulary');
    if (!empty($vid)) {
        return $this->entityTypeManager
            ->getStorage('taxonomy_vocabulary')
            ->load($vid);
    }
    else {
        return NULL;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.