summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2014-04-07 15:00:03 (GMT)
committerwebchick2014-04-07 15:00:03 (GMT)
commit5c1869b6128d645588d482348ea105b6ee657a48 (patch)
tree4f0126e9bfc20e30f8b6c6f5627e4defaf6f702f
parent27a651a6e71e8c03ad23401a925798a68f2b148d (diff)
Issue #2228941 by larowlan, andrei.dincu | Cottser: PHP notice displayed for forum blocks when there are no forum topics.
-rw-r--r--core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php1
-rw-r--r--core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php7
2 files changed, 5 insertions, 3 deletions
diff --git a/core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php b/core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php
index 6b760a9..d7dfc31 100644
--- a/core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php
+++ b/core/modules/forum/lib/Drupal/forum/Plugin/Block/ForumBlockBase.php
@@ -21,6 +21,7 @@ abstract class ForumBlockBase extends BlockBase {
*/
public function build() {
$result = $this->buildForumQuery()->execute();
+ $elements = array();
if ($node_title_list = node_title_list($result)) {
$elements['forum_list'] = $node_title_list;
$elements['forum_more'] = array(
diff --git a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php
index 3799288..1295c82 100644
--- a/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php
+++ b/core/modules/forum/lib/Drupal/forum/Tests/ForumBlockTest.php
@@ -55,13 +55,14 @@ class ForumBlockTest extends WebTestBase {
public function testNewForumTopicsBlock() {
$this->drupalLogin($this->adminUser);
- // Create 5 forum topics.
- $topics = $this->createForumTopics();
-
// Enable the new forum topics block.
$block = $this->drupalPlaceBlock('forum_new_block');
$this->drupalGet('');
+ // Create 5 forum topics.
+ $topics = $this->createForumTopics();
+
+
$this->assertLink(t('More'), 0, 'New forum topics block has a "more"-link.');
$this->assertLinkByHref('forum', 0, 'New forum topics block has a "more"-link.');