function template_preprocess_duration_field_duration_time in Duration Field 8.2
Same name and namespace in other branches
- 3.0.x duration_field.module \template_preprocess_duration_field_duration_time()
Preprocesses duration_field_duration_time templates.
File
- ./
duration_field.module, line 43 - Holds hooks for the Duration Field module.
Code
function template_preprocess_duration_field_duration_time(&$vars) {
$vars['year'] = $vars['item']
->format('%y');
$vars['month'] = $vars['item']
->format('%m');
$vars['day'] = $vars['item']
->format('%d');
$vars['hour'] = $vars['item']
->format('%h');
if (strlen($vars['hour']) == 1) {
$vars['hour'] = '0' . $vars['hour'];
}
$vars['minute'] = $vars['item']
->format('%i');
if (strlen($vars['minute']) == 1) {
$vars['minute'] = '0' . $vars['minute'];
}
$vars['second'] = $vars['item']
->format('%s');
if (strlen($vars['second']) == 1) {
$vars['second'] = '0' . $vars['second'];
}
}