function timefield_field_formatter_view in Timefield 7
Implements hook_field_formatter_view().
File
- ./
timefield.module, line 686 - Defines a Field API field for time
Code
function timefield_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
$settings = $display['settings'];
$settings += $field['settings'];
$element = array();
switch ($display['type']) {
case 'timefield_default':
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#theme' => array(
'timefield',
),
'#time' => $item,
'#settings' => $settings,
'#format' => 'default',
);
}
break;
case 'timefield_duration':
foreach ($items as $delta => $item) {
$element[$delta] = array(
'#theme' => array(
'timefield',
),
'#time' => $item,
'#settings' => $settings,
'#format' => 'duration',
);
}
break;
case 'timefield_weekly_summary_minical':
$header = _timefield_weekly_summary_build_header($settings['first_day']);
$rows = timefield_weekly_summary_build_rows($items, $header, $settings);
$element[0] = array(
'#header' => $header,
'#rows' => $rows,
'#theme' => 'table',
);
break;
}
return $element;
}