You are here

function theme_calendar_stripe_legend in Calendar 6.2

Same name in this branch
  1. 6.2 theme/theme.inc \theme_calendar_stripe_legend()
  2. 6.2 calendar_multiday/theme/theme.inc \theme_calendar_stripe_legend()
Same name and namespace in other branches
  1. 5.2 calendar.theme \theme_calendar_stripe_legend()
  2. 5 calendar.theme \theme_calendar_stripe_legend()
  3. 7.3 theme/theme.inc \theme_calendar_stripe_legend()
  4. 7 theme/theme.inc \theme_calendar_stripe_legend()
  5. 7 calendar_multiday/theme/theme.inc \theme_calendar_stripe_legend()
  6. 7.2 theme/theme.inc \theme_calendar_stripe_legend()
  7. 7.2 calendar_multiday/theme/theme.inc \theme_calendar_stripe_legend()

Format a node stripe legend

1 theme call to theme_calendar_stripe_legend()
calendar_block in ./calendar.module
implementation of hook_block()

File

theme/theme.inc, line 690

Code

function theme_calendar_stripe_legend() {
  if (empty($GLOBALS['calendar_stripes'])) {
    return '';
  }
  $header = array(
    array(
      'class' => 'calendar-legend',
      'data' => t('Item'),
    ),
    array(
      'class' => 'calendar-legend',
      'data' => t('Key'),
    ),
  );
  $rows = array();
  $output = '';
  foreach ((array) $GLOBALS['calendar_stripes'] as $label => $stripe) {
    if ($stripe) {
      $rows[] = array(
        $label,
        '<div style="background-color:' . $stripe . ';color:' . $stripe . '" class="stripe" title="Key: ' . $label . '">&nbsp;</div>',
      );
    }
  }
  if (!empty($rows)) {
    $output .= theme('table', $header, $rows, array(
      'class' => 'mini calendar-legend',
    ));
  }
  return $output;
}