From 7abdb6540b2ecddef880413df92cb2592539d145 Mon Sep 17 00:00:00 2001 From: webchick <drupal@webchick.net> Date: Sun, 14 Dec 2014 13:53:22 -0800 Subject: [PATCH] Issue #2350309 by droplet, larowlan: Forum index links head to taxonomy/term/{term} instead of forum/{term} --- core/modules/forum/forum.module | 2 +- core/modules/forum/src/Tests/ForumTest.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/modules/forum/forum.module b/core/modules/forum/forum.module index d4be4f5547ac..c5e6d41b1a97 100644 --- a/core/modules/forum/forum.module +++ b/core/modules/forum/forum.module @@ -568,7 +568,7 @@ function template_preprocess_forum_list(&$variables) { // Sanitize each forum so that the template can safely print the data. foreach ($variables['forums'] as $id => $forum) { $variables['forums'][$id]->description = Xss::filterAdmin($forum->description->value); - $variables['forums'][$id]->link = $forum->url(); + $variables['forums'][$id]->link = forum_uri($forum); $variables['forums'][$id]->name = String::checkPlain($forum->label()); $variables['forums'][$id]->is_container = !empty($forum->forum_container->value); $variables['forums'][$id]->zebra = $row % 2 == 0 ? 'odd' : 'even'; diff --git a/core/modules/forum/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php index 57239a462116..c716f5ad6c75 100644 --- a/core/modules/forum/src/Tests/ForumTest.php +++ b/core/modules/forum/src/Tests/ForumTest.php @@ -10,6 +10,7 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Link; use Drupal\simpletest\WebTestBase; +use Drupal\Core\Url; /** * Create, view, edit, delete, and change forum entries and verify its @@ -107,9 +108,9 @@ protected function setUp() { */ function testForum() { //Check that the basic forum install creates a default forum topic - $this->drupalGet("/forum"); + $this->drupalGet('/forum'); // Look for the "General discussion" default forum - $this->assertText(t("General discussion"), "Found the default forum at the /forum listing"); + $this->assertRaw(t('<a href="'. Url::fromRoute('forum.page', ['taxonomy_term' => 1]) .'">General discussion</a>'), "Found the default forum at the /forum listing"); // Do the admin tests. $this->doAdminTests($this->admin_user); -- GitLab