function _timefield_display_format_form in Timefield 7
Same name and namespace in other branches
- 1.0.x timefield.module \_timefield_display_format_form()
Helper Function to build settings form
Parameters
string $name: The name of the element array
string $fieldset_header: The title for the fieldset
array $settings: The settings parameters
Return value
array $element Form Element
1 call to _timefield_display_format_form()
File
- ./
timefield.module, line 474 - Defines a Field API field for time
Code
function _timefield_display_format_form($name, $fieldset_header, $settings) {
$element[$name] = array(
'#title' => check_plain($fieldset_header),
'#type' => 'fieldset',
);
$element[$name]['hour'] = array(
'#title' => t('Hour Format'),
'#type' => 'select',
'#default_value' => isset($settings[$name]['hour']) ? $settings[$name]['hour'] : 'g',
'#options' => _timefield_time_part_format('hour'),
);
$element[$name]['minute'] = array(
'#title' => t('Minute Format'),
'#type' => 'select',
'#default_value' => isset($settings[$name]['minute']) ? $settings[$name]['minute'] : 'i',
'#options' => _timefield_time_part_format('minute'),
);
$element[$name]['separator'] = array(
'#title' => t('Hour and Minute Separator'),
'#type' => 'textfield',
'#default_value' => isset($settings[$name]['separator']) ? $settings[$name]['separator'] : ':',
'#size' => 10,
);
$element[$name]['period'] = array(
'#title' => t('AM/PM format'),
'#type' => 'select',
'#default_value' => isset($settings[$name]['period']) ? $settings[$name]['period'] : 'a',
'#options' => _timefield_time_part_format('period'),
);
$element[$name]['period_separator'] = array(
'#title' => t('Minute and period separtor'),
'#type' => 'textfield',
'#default_value' => isset($settings[$name]['period_separator']) ? $settings[$name]['period_separator'] : '',
'#size' => 10,
'#description' => t('The character used to separate the time from the time period (AM/PM)'),
);
return $element;
}