mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 09:05:58 +00:00
check if the method exists before jumping into the foreach loop. was causing problems in some situations
This commit is contained in:
parent
bbd2815316
commit
fc03f9f329
@ -31,13 +31,15 @@ class RSSWidget extends Widget {
|
|||||||
|
|
||||||
function FeedItems() {
|
function FeedItems() {
|
||||||
$output = new DataObjectSet();
|
$output = new DataObjectSet();
|
||||||
foreach($this->feed->get_items(0, $this->NumberToShow) as $item) {
|
if($items = $this->feed->get_items(0, $this->NumberToShow)) {
|
||||||
$output->push(new ArrayData(array(
|
foreach($items as $item) {
|
||||||
"Title" => $item->get_title(),
|
$output->push(new ArrayData(array(
|
||||||
"Link" => $item->get_link()
|
"Title" => $item->get_title(),
|
||||||
)));
|
"Link" => $item->get_link()
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
return $output;
|
||||||
}
|
}
|
||||||
return $output;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user