1.20.x block.news.inc public DashboardNewsBlock::getContent()

Return the content of a block.

Return value

mixed:

Overrides Block::getContent

File

modules/dashboard/includes/block.news.inc, line 41
Dashboard block displaying BackdropCMS.org news items.

Class

DashboardNewsBlock

Code

public function getContent() {
  $news = $this->getNews();
  $links = array();
  if ($news) {
    foreach ($news as $key => $notifications) {
      $links[] = '<p>' . l(
      $notifications['title'], 
      $notifications['url']
      ) . ' - ' . filter_xss($notifications['summary']) . '</p>';
    }
  }

  $build = array();
  if (empty($links)) {
    $build['list'] = array(
      '#type' => 'markup',
      '#markup' => t('No news at this time.'),
    );
  }
  else {
    $build['list'] = array(
      '#theme' => 'item_list',
      '#items' => $links,
    );
  }

  return $build;
}