function theme_calendar_arg_title in Calendar 5
Same name and namespace in other branches
- 5.2 calendar.theme \theme_calendar_arg_title()
Theme the calendar title and breadcrumbs Arguments are evaluated in year, month, day or year, week order so you can track previous values in the session.
Parameters
string $field_type - 'YEAR', 'MONTH', 'DAY', 'WEEK':
integer $value - the current number for the field type as selected in the view argument.:
Return value
string formatted title
1 theme call to theme_calendar_arg_title()
- calendar_handler_arg_type in ./
calendar.module - Custom views handler for all calendar arguments.
File
- ./
calendar.theme, line 203
Code
function theme_calendar_arg_title($field_type, $value, $query) {
$view = $GLOBALS['current_view'];
calendar_load_date_api();
$value = intval(check_plain($value));
if (empty($value)) {
if ($view->month) {
if ($view->month == "all") {
$view->month = 1;
}
$stamp = date_gmmktime(array(
'year' => $view->year,
'mon' => $view->month,
'mday' => 1,
));
return date_format_date('F Y', $stamp);
}
elseif ($view->year) {
return $view->year;
}
}
else {
switch ($field_type) {
case 'YEAR':
$view->year = $value;
return $view->year;
case 'MONTH':
$view->month = $value;
$stamp = date_gmmktime(array(
'year' => $view->year,
'mon' => $view->month,
'mday' => 1,
));
return date_format_date('F Y', $stamp);
case 'DAY':
$stamp = date_gmmktime(array(
'year' => $view->year,
'mon' => $view->month,
'mday' => $value,
));
return date_format_date('l, F j Y', $stamp);
case 'WEEK':
return t('Week @week @year', array(
'@year' => $view->year,
'@week' => $value,
));
}
}
}