summaryrefslogtreecommitdiff
path: root/modules/aggregator
diff options
context:
space:
mode:
Diffstat (limited to 'modules/aggregator')
-rw-r--r--modules/aggregator/aggregator.module10
-rw-r--r--modules/aggregator/aggregator.test10
2 files changed, 17 insertions, 3 deletions
diff --git a/modules/aggregator/aggregator.module b/modules/aggregator/aggregator.module
index 9319ad9b8..686f4248a 100644
--- a/modules/aggregator/aggregator.module
+++ b/modules/aggregator/aggregator.module
@@ -18,7 +18,7 @@ function aggregator_help($path, $arg) {
case 'admin/help#aggregator':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
- $output .= '<p>' . t('The Aggregator module is an on-site syndicator and news reader that gathers and displays fresh content from RSS-, RDF-, and Atom-based feeds made available across the web. Thousands of sites (particularly news sites and blogs) publish their latest headlines in feeds, using a number of standardized XML-based formats. For more information, see the online handbook entry for <a href="@aggregator-module">Aggregator module</a>.', array('@aggregator-module' => 'http://drupal.org/handbook/modules/aggregator', '@aggregator' => url('aggregator'))) . '</p>';
+ $output .= '<p>' . t('The Aggregator module is an on-site syndicator and news reader that gathers and displays fresh content from RSS-, RDF-, and Atom-based feeds made available across the web. Thousands of sites (particularly news sites and blogs) publish their latest headlines in feeds, using a number of standardized XML-based formats. For more information, see the online handbook entry for <a href="@aggregator-module">Aggregator module</a>.', array('@aggregator-module' => 'http://drupal.org/documentation/modules/aggregator', '@aggregator' => url('aggregator'))) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Viewing feeds') . '</dt>';
@@ -397,6 +397,7 @@ function aggregator_block_view($delta = '') {
if (user_access('access news feeds')) {
$block = array();
list($type, $id) = explode('-', $delta);
+ $result = FALSE;
switch ($type) {
case 'feed':
if ($feed = db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE block <> 0 AND fid = :fid', array(':fid' => $id))->fetchObject()) {
@@ -414,9 +415,12 @@ function aggregator_block_view($delta = '') {
}
break;
}
+
$items = array();
- foreach ($result as $item) {
- $items[] = theme('aggregator_block_item', array('item' => $item));
+ if (!empty($result)) {
+ foreach ($result as $item) {
+ $items[] = theme('aggregator_block_item', array('item' => $item));
+ }
}
// Only display the block if there are items to show.
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index 5609d68ae..77b60cb93 100644
--- a/modules/aggregator/aggregator.test
+++ b/modules/aggregator/aggregator.test
@@ -848,6 +848,16 @@ class AggregatorRenderingTestCase extends AggregatorTestCase {
$this->drupalGet($href);
$correct_titles = $this->xpath('//h1[normalize-space(text())=:title]', array(':title' => $feed->title));
$this->assertFalse(empty($correct_titles), t('Aggregator feed page is available and has the correct title.'));
+
+ // Set the number of news items to 0 to test that the block does not show
+ // up.
+ $feed->block = 0;
+ aggregator_save_feed((array) $feed);
+ // It is nescessary to flush the cache after saving the number of items.
+ drupal_flush_all_caches();
+ // Check that the block is no longer displayed.
+ $this->drupalGet('node');
+ $this->assertNoText(t($block['title']), 'Feed block is not displayed on the page when number of items is set to 0.');
}
/**