You are here

function agenda_display_block in Agenda 7.2

Same name and namespace in other branches
  1. 6.2 agenda.module \agenda_display_block()
  2. 6 agenda.module \agenda_display_block()
  3. 7 agenda.module \agenda_display_block()

Generate the themed agenda block.

Return value

string

1 call to agenda_display_block()
agenda_block_view in ./agenda.module
Implements hook_block_view().

File

./agenda.module, line 211

Code

function agenda_display_block($delta = 0) {

  // Check block exists.
  if ($delta === 0 || !($block = agenda_settings($delta))) {
    return false;
  }

  // Get the events for the block.
  $events = agenda_get_events($block);

  // Group the events by date.
  $events = agenda_group_events_for_block($block, $events);

  // Render.
  if (count($events)) {
    $output = theme('agenda_block', array(
      'events' => $events,
      'block' => $block,
    ));
  }
  elseif (empty($block->noeventstext)) {
    $output = NULL;
  }
  else {
    $output = filter_xss($block->noeventstext);
  }
  return $output;
}