You are here

public function OrganigramsController::viewOrganigram in Organigrams 8.2

Same name and namespace in other branches
  1. 8 src/Controller/OrganigramsController.php \Drupal\organigrams\Controller\OrganigramsController::viewOrganigram()

Returns a form to add a new term to a vocabulary.

Parameters

\Drupal\taxonomy\VocabularyInterface $taxonomy_vocabulary: The vocabulary this term will be added to.

Return value

array The organigram as a render array.

1 string reference to 'OrganigramsController::viewOrganigram'
organigrams.routing.yml in ./organigrams.routing.yml
organigrams.routing.yml

File

src/Controller/OrganigramsController.php, line 61

Class

OrganigramsController
Provides route responses for organigrams.module.

Namespace

Drupal\organigrams\Controller

Code

public function viewOrganigram(VocabularyInterface $taxonomy_vocabulary) {
  $output = [];

  // Check for permission.
  if (!$this
    ->currentUser()
    ->hasPermission('view organigrams')) {
    return $output;
  }

  // Use our own service to get the hierarchical overview of taxonomy terms
  // in this vocabulary.
  $output = $this->taxonomyTermTree
    ->loadList($taxonomy_vocabulary
    ->id());

  // Include the organigram css.
  $output['#attached']['library'][] = 'organigrams/organigrams';
  return $output;
}