function ForumController::addForum

Same name in other branches
  1. 8.9.x core/modules/forum/src/Controller/ForumController.php \Drupal\forum\Controller\ForumController::addForum()
  2. 10 core/modules/forum/src/Controller/ForumController.php \Drupal\forum\Controller\ForumController::addForum()
  3. 11.x core/modules/forum/src/Controller/ForumController.php \Drupal\forum\Controller\ForumController::addForum()

Returns add forum entity form.

Return value

array Render array for the add form.

1 string reference to 'ForumController::addForum'
forum.routing.yml in core/modules/forum/forum.routing.yml
core/modules/forum/forum.routing.yml

File

core/modules/forum/src/Controller/ForumController.php, line 254

Class

ForumController
Controller routines for forum routes.

Namespace

Drupal\forum\Controller

Code

public function addForum() {
    $vid = $this->config('forum.settings')
        ->get('vocabulary');
    $taxonomy_term = $this->termStorage
        ->create([
        'vid' => $vid,
    ]);
    return $this->entityFormBuilder()
        ->getForm($taxonomy_term, 'forum');
}

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