Skip to content
Snippets Groups Projects
Commit 622c5afa authored by catch's avatar catch
Browse files

Issue #3197754 by mohit_aghera, baliram.patil, ilgnerfagundes, Elin Yordanov,...

Issue #3197754 by mohit_aghera, baliram.patil, ilgnerfagundes, Elin Yordanov, larowlan, anmolgoyal74, guilhermevp: "Add new Forum topic" button appears also in forum containers
parent 1caf6013
Branches
Tags
6 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!16Draft: Resolve #2081585 "History storage"
......@@ -235,8 +235,9 @@ protected function build($forums, TermInterface $term, $topics = [], $parents =
}
$this->renderer->addCacheableDependency($build, $term);
$is_forum = empty($term->forum_container->value);
return [
'action' => $this->buildActionLinks($config->get('vocabulary'), $term),
'action' => ($is_forum) ? $this->buildActionLinks($config->get('vocabulary'), $term) : [],
'forum' => $build,
'#cache' => [
'tags' => Cache::mergeTags($this->nodeEntityTypeDefinition->getListCacheTags(), $this->commentEntityTypeDefinition->getListCacheTags()),
......
......@@ -719,4 +719,21 @@ private function generateForumTopics() {
}
}
/**
* Evaluate whether "Add new Forum topic" button is present or not.
*/
public function testForumTopicButton() {
$this->drupalLogin($this->adminUser);
// Validate that link doesn't exist on the forum container page.
$forum_container = $this->createForum('container');
$this->drupalGet('forum/' . $forum_container['tid']);
$this->assertSession()->linkNotExists('Add new Forum topic');
// Validate that link exists on forum page.
$forum = $this->createForum('forum');
$this->drupalGet('forum/' . $forum['tid']);
$this->assertSession()->linkExists('Add new Forum topic');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment