Commit d39e25de authored by catch's avatar catch
Browse files

Issue #3212354 by guilhermevp, Chi: AggregatorFeedBlock::build must always return array

(cherry picked from commit ebf0c951)
(cherry picked from commit ff99906c)
parent 03355b6e
......@@ -127,37 +127,38 @@ public function blockSubmit($form, FormStateInterface $form_state) {
*/
public function build() {
// Load the selected feed.
if ($feed = $this->feedStorage->load($this->configuration['feed'])) {
$result = $this->itemStorage->getQuery()
->accessCheck(TRUE)
->condition('fid', $feed->id())
->range(0, $this->configuration['block_count'])
->sort('timestamp', 'DESC')
->sort('iid', 'DESC')
->execute();
if ($result) {
// Only display the block if there are items to show.
$items = $this->itemStorage->loadMultiple($result);
$build['list'] = [
'#theme' => 'item_list',
'#items' => [],
];
foreach ($items as $item) {
$build['list']['#items'][$item->id()] = [
'#type' => 'link',
'#url' => $item->toUrl(),
'#title' => $item->label(),
];
}
$build['more_link'] = [
'#type' => 'more_link',
'#url' => $feed->toUrl(),
'#attributes' => ['title' => $this->t("View this feed's recent news.")],
if (!$feed = $this->feedStorage->load($this->configuration['feed'])) {
return [];
}
$result = $this->itemStorage->getQuery()
->accessCheck(TRUE)
->condition('fid', $feed->id())
->range(0, $this->configuration['block_count'])
->sort('timestamp', 'DESC')
->sort('iid', 'DESC')
->execute();
if ($result) {
// Only display the block if there are items to show.
$items = $this->itemStorage->loadMultiple($result);
$build['list'] = [
'#theme' => 'item_list',
'#items' => [],
];
foreach ($items as $item) {
$build['list']['#items'][$item->id()] = [
'#type' => 'link',
'#url' => $item->toUrl(),
'#title' => $item->label(),
];
return $build;
}
$build['more_link'] = [
'#type' => 'more_link',
'#url' => $feed->toUrl(),
'#attributes' => ['title' => $this->t("View this feed's recent news.")],
];
return $build;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment