function jst_clock_form_alter in Javascript Timer 7
Same name and namespace in other branches
- 6 widgets/jst_clock.module \jst_clock_form_alter()
Implementation of hook_form_alter(). Add the clock widget specific settings to admin screen.
File
- widgets/
jst_clock.module, line 272 - Embeddable clock widget (optional).
Code
function jst_clock_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
//change this to form_id of the form you want to alter
case 'jstimer_admin_settings':
$form['jst_clock'] = array(
'#type' => 'fieldset',
'#title' => t('Clock widget'),
'#description' => '<span class="jst_clock"></span><br/>' . t('After saving, you need to reload the page to see the new clock.'),
'#weight' => 1,
);
$form['jst_clock']['jstimer_jst_clock_type'] = array(
'#type' => 'radios',
'#title' => t('Clock type'),
'#default_value' => variable_get('jstimer_jst_clock_type', DEFAULT_CLOCK_TYPE),
'#options' => array(
0 => t('12-hour plain text'),
1 => t('24-hour plain text'),
2 => t('Analog canvas'),
3 => t('Analog SVG'),
),
'#description' => t("The analog clocks are experimental and only works on Firefox, Opera, and Safari and IE9."),
);
$form['jst_clock']['jst_clock_sva_file'] = array(
'#type' => 'textfield',
'#title' => t('Clock svg file'),
'#default_value' => variable_get('jst_clock_sva_file', 'sleek1.svg'),
'#description' => t('The name of the svg file to use for the SVG clock. They are stored in the widgets/clocks sub directory.'),
);
$form['buttons']['#weight'] = 2;
break;
}
}