function date_formatter_format in Date 7
Same name and namespace in other branches
- 8 date.module \date_formatter_format()
- 5.2 date/date.module \date_formatter_format()
- 6.2 date/date.module \date_formatter_format()
- 6 date/date.module \date_formatter_format()
- 7.3 date.module \date_formatter_format()
- 7.2 date.module \date_formatter_format()
Retrieve a date format string from formatter settings.
1 call to date_formatter_format()
- date_formatter_process in ./
date.module - Helper function for creating formatted date arrays from a formatter.
File
- ./
date.module, line 428
Code
function date_formatter_format($formatter, $settings, $granularity = NULL, $langcode = NULL) {
$default = variable_get('date_format_medium', 'D, m/d/Y - H:i');
$format_type = !empty($settings['format_type']) ? $settings['format_type'] : 'format_interval';
switch ($formatter) {
case 'format_interval':
return 'format_interval';
break;
case 'date_default':
$format = system_date_format_locale($langcode, $format_type);
if (empty($format)) {
$format = variable_get('date_format_' . $format_type, $default);
}
break;
default:
$type = str_replace('date_', '', $formatter);
$format = system_date_format_locale($langcode, $type);
if (empty($format)) {
$format = variable_get('date_format_' . $type, $default);
}
break;
}
// A selected format might include timezone information.
array_push($granularity, 'timezone');
return date_limit_format($format, $granularity);
}