You are here

function theme_availability_calendar_key in Availability Calendars 7.4

Same name and namespace in other branches
  1. 7.5 availability_calendar.theme.inc \theme_availability_calendar_key()
  2. 7.3 availability_calendar.theme.inc \theme_availability_calendar_key()

Themes the key for our calendars.

Parameters

array $variables:

Return value

string

1 theme call to theme_availability_calendar_key()
availability_calendar_block_view in ./availability_calendar.module
Implements hook_block_view(). @link http://api.drupal.org/api/drupal/modules--block--block.api.php/function/...

File

./availability_calendar.theme.inc, line 397

Code

function theme_availability_calendar_key($variables) {
  $caption = '';
  $rows = array();
  $states_to_show = isset($variables['states_to_show']) ? $variables['states_to_show'] : array();
  $states = availability_calendar_get_states(array_filter($states_to_show));
  foreach ($states as $state) {
    $rows[] = array(
      // Use the same classes here as in the calendar, so it styles the same.
      array(
        'data' => '<div>' . check_plain(t($state['label'])) . '</div>',
        'class' => $state['css_class'],
        'no_striping' => TRUE,
      ),
    );
  }
  $key = theme('table', array(
    'caption' => $caption,
    'rows' => $rows,
    'sticky' => FALSE,
  ));
  return '<div class="cal-key">' . $key . '</div>';
}