You are here

function theme_calendar_stripe_legend in Calendar 7

Same name in this branch
  1. 7 theme/theme.inc \theme_calendar_stripe_legend()
  2. 7 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. 6.2 theme/theme.inc \theme_calendar_stripe_legend()
  4. 6.2 calendar_multiday/theme/theme.inc \theme_calendar_stripe_legend()
  5. 7.3 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_view in ./calendar.module
implementation of hook_block_view()

File

calendar_multiday/theme/theme.inc, line 861
Theme functions for the Calendar module.

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)) {
    $variables = array(
      'header' => $header,
      'rows' => $rows,
      'attributes' => array(
        'class' => 'mini calendar-legend',
      ),
    );
    $output .= theme('table', $variables);
  }
  return $output;
}