You are here

function theme_calendar_nav_title in Calendar 5.2

Same name and namespace in other branches
  1. 5 calendar.theme \theme_calendar_nav_title()

Theme the navigation bar title

Parameters

string $type - 'year', 'month', 'day', 'week':

object $view - the current view object:

Return value

formatted title

3 theme calls to theme_calendar_nav_title()
calendar_views_pre_view in ./calendar.module
Implementation of hook_views_pre_view()
theme_calendar_nav in ./calendar.theme
Function to construct back and next navigation from views arguments
theme_calendar_year in ./calendar.theme
Format a year view

File

./calendar.theme, line 323

Code

function theme_calendar_nav_title($type, $view, $link = FALSE, $format = NULL) {
  $real_url = calendar_real_url($view, $view->args);
  switch ($type) {
    case 'year':
      $title = $view->year;
      $url = $real_url . '/' . $view->year;
      break;
    case 'month':
      $format = !empty($format) ? $format : (!$view->mini ? 'F Y' : 'F');
      $title = date_format_date($view->min_date, 'custom', $format);
      $url = $real_url . '/' . $view->year . '/' . $view->month;
      break;
    case 'day':
      $format = !empty($format) ? $format : (!$view->mini ? 'l, F j Y' : 'l, F j');
      $title = date_format_date($view->min_date, 'custom', $format);
      $url = $real_url . '/' . $view->year . '/' . $view->month . '/' . $view->day;
      break;
    case 'week':
      $format = !empty($format) ? $format : (!$view->mini ? 'F j Y' : 'F j');
      $title = t('Week of @date', array(
        '@date' => date_format_date($view->min_date, 'custom', $format),
      ));
      $url = $real_url . '/' . $view->year . '/' . $view->week;
      break;
  }

  // Month navigation titles are used as links in the mini view.
  if ($view->mini || $link) {

    // We don't want to pass along the block_identifier, so we set it to NULL.
    $block_identifier = isset($view->block_identifier) ? $view->block_identifier : 'mini';
    return l($title, $url, array(), calendar_querystring($view, array(
      $block_identifier => NULL,
    )));
  }
  else {
    return $title;
  }
}