Skip to content

Commit 98593a2

Browse files
committed
Settings are always populated
1 parent 01fc92f commit 98593a2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

cs_date_formatter.module

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function cs_date_formatter_field_formatter_settings_form($field, $instance, $vie
4141
$display = $instance['display'][$view_mode];
4242
$settings = $display['settings'];
4343
$element = array();
44+
4445
$element['date_format'] = array(
4546
'#title' => t('Format'),
4647
'#type' => 'radios',
@@ -85,49 +86,49 @@ function cs_date_formatter_field_formatter_settings_form($field, $instance, $vie
8586
'#type' => 'select',
8687
'#title' => t('Weekday display'),
8788
'#options' => array_merge($options, $options_nsl),
88-
'#default_value' => isset($settings['weekday']) ? $settings['weekday'] : 'hidden',
89+
'#default_value' => $settings['weekday'],
8990
) + $element_commons;
9091
$element['year'] = array(
9192
'#type' => 'select',
9293
'#title' => t('Year display'),
9394
'#options' => array_merge($options, $options_n2d),
94-
'#default_value' => isset($settings['year']) ? $settings['year'] : 'numeric',
95+
'#default_value' => $settings['year'],
9596
) + $element_commons;
9697
$element['month'] = array(
9798
'#type' => 'select',
9899
'#title' => t('Month display'),
99100
'#options' => array_merge($options, $options_n2d, $options_nsl),
100-
'#default_value' => isset($settings['month']) ? $settings['month'] : 'short',
101+
'#default_value' => $settings['month'],
101102
) + $element_commons;
102103
$element['day'] = array(
103104
'#type' => 'select',
104105
'#title' => t('Day display'),
105106
'#options' => array_merge($options, $options_n2d),
106-
'#default_value' => isset($settings['day']) ? $settings['day'] : '2-digit',
107+
'#default_value' => $settings['day'],
107108
) + $element_commons;
108109
$element['hour'] = array(
109110
'#type' => 'select',
110111
'#title' => t('Hour display'),
111112
'#options' => array_merge($options, $options_n2d),
112-
'#default_value' => isset($settings['hour']) ? $settings['hour'] : '2-digit',
113+
'#default_value' => $settings['hour'],
113114
) + $element_commons;
114115
$element['minute'] = array(
115116
'#type' => 'select',
116117
'#title' => t('Minute display'),
117118
'#options' => array_merge($options, $options_n2d),
118-
'#default_value' => isset($settings['minute']) ? $settings['minute'] : '2-digit',
119+
'#default_value' => $settings['minute'],
119120
) + $element_commons;
120121
$element['second'] = array(
121122
'#type' => 'select',
122123
'#title' => t('Seconds display'),
123124
'#options' => array_merge($options, $options_n2d),
124-
'#default_value' => isset($settings['second']) ? $settings['second'] : 'hidden',
125+
'#default_value' => $settings['second'],
125126
) + $element_commons;
126127
$element['timezonename'] = array(
127128
'#type' => 'select',
128129
'#title' => t('Timezone name display'),
129130
'#options' => array_merge($options, $options_sl),
130-
'#default_value' => isset($settings['timezonename']) ? $settings['timezonename'] : 'short',
131+
'#default_value' => $settings['timezonename'],
131132
) + $element_commons;
132133

133134
$element['#attached']['css'] = array(

0 commit comments

Comments
 (0)