Issue #1920744 by Berdir: Fixed Fatal error on aggregator/categories.

8.0.x
webchick 2013-02-26 18:29:42 -05:00
parent 72558ac865
commit 3714bed1e9
2 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,7 @@
*/
use Drupal\aggregator\Plugin\Core\Entity\Feed;
use Drupal\Core\Entity\EntityInterface;
/**
* Page callback: Displays the most recent items gathered from any feed.
@ -563,7 +564,7 @@ function theme_aggregator_page_opml($variables) {
* @see aggregator-summary-items.tpl.php
*/
function template_preprocess_aggregator_summary_items(&$variables) {
$variables['title'] = check_plain($variables['source']->label());
$variables['title'] = check_plain($variables['source'] instanceof EntityInterface ? $variables['source']->label() : $variables['source']->title);
$summary_items = array();
foreach (element_children($variables['summary_items']) as $key) {
$summary_items[] = $variables['summary_items'][$key];
@ -572,7 +573,7 @@ function template_preprocess_aggregator_summary_items(&$variables) {
'#theme' => 'item_list',
'#items' => $summary_items,
);
$variables['source_url'] = $variables['source']->url->value;
$variables['source_url'] = $variables['source'] instanceof EntityInterface ? $variables['source']->url->value : $variables['source']->url;
}
/**

View File

@ -48,5 +48,10 @@ class CategorizeFeedTest extends AggregatorTestBase {
$db_feed = aggregator_feed_load($db_fid);
// Assert the feed has two categories.
$this->assertEqual(count($db_feed->categories), 2, 'Feed has 2 categories');
// Verify the categories overview page is correctly displayed.
$this->drupalGet('aggregator/categories');
$this->assertText($category_1['title']);
$this->assertText($category_2['title']);
}
}