You are here

function calendar_block in Calendar 5.2

Same name and namespace in other branches
  1. 5 calendar.module \calendar_block()
  2. 6.2 calendar.module \calendar_block()

implementation of hook_block()

File

./calendar.module, line 459
Adds calendar filtering and displays to Views.

Code

function calendar_block($op = 'list', $delta = 0) {
  switch ($op) {
    case 'list':
      $blocks[0]['info'] = t('Calendar Legend.');
      $blocks[1]['info'] = t('Calendar Switcher.');
      return $blocks;
      break;
    case 'view':
      switch ($delta) {
        case 0:
          $block['subject'] = t('Calendar Legend');
          $content = theme('calendar_stripe_legend');
          $block['content'] = !empty($content) ? '<div class="calendar legend">' . $content . '</div>' : '';
          return $block;
        case 1:
          $block['subject'] = t('Calendar Switcher');
          $block['content'] = $GLOBALS['calendar_is_calendar'] ? drupal_get_form('calendar_switch_view') : '';
          return $block;
      }
  }
}