Projet

Général

Profil

Révision 74f6bef0

Ajouté par Assos Assos il y a plus de 10 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/themes/adaptivetheme/at_core/inc/forms/settings.pagelayout.inc
4 4
 * @file
5 5
 * Generate form elments for the Page Layout settings.
6 6
 */
7
function at_core_page_layout_form(&$form, $theme_name) {
8
  // Get an array of device groups with option values
9
  $device_group_options = responsive_page_layouts_device_group_options($theme_name);
10

  
11
  // Assign $options for each device group
12
  foreach ($device_group_options as $device_group => $options) {
13

  
14
    // About here we need to call a custom sort function, this is what we got for now
15
    sort($options, SORT_STRING);
16

  
17
    foreach ($options as $option) {
18
      if ($device_group === 'bigscreen') {
19
        $bigscreen_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); // human readable option names for accessibility
20
      }
21
      if ($device_group === 'tablet_landscape') {
22
        $tablet_landscape_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option));
23
      }
24
      if ($device_group === 'tablet_portrait') {
25
        $tablet_portrait_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option));
26
      }
27
      if ($device_group === 'smalltouch_landscape') {
28
        $smalltouch_landscape_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option));
29
      }
30
    }
31
  }
7 32

  
8
// Get an array of device groups with option values
9
$device_group_options = responsive_page_layouts_device_group_options($theme_name);
33
  // CSS for page layout icons
34
  $page_layout_css_files = responsive_plugins_admin_css($theme_name, $plugin_type = 'page_layout');
35
  foreach ($page_layout_css_files as $filepath) {
36
    if (file_exists($filepath)) {
37
      $page_layout_css['css'][] = array('type' => 'file', 'data' => $filepath, 'weight' => 100);
38
    }
39
  }
10 40

  
11
// Assign $options for each device group
12
foreach ($device_group_options as $device_group => $options) {
41
  // Unit options
42
  $unit_options = array('%' => '%', 'px' => 'px', 'em' => 'em');
43

  
44
  // Set a message for when responsive layout is turned off
45
  $disable_message = t('<p>The responsive layout is disabled, only the Standard layout is now used.</p><p>To re-enable uncheck the "Disable responsive layout and styles" checkbox under the "Global Settings" tab.</p>');
46

  
47
  /*****************************************************************************
48
   *
49
   * Bigscreen (standard-layout)
50
   *
51
   ****************************************************************************/
52

  
53
  $form['at-settings']['bigscreen'] = array(
54
    '#type' => 'fieldset',
55
    '#title' => t('Standard Layout'),
56
    '#description' => t('<h3>Standard Layout</h3><p>The standard layout is for desktops, laptops and other large screen devices.'),
57
    '#attached' => $page_layout_css,
58
    '#attributes' => array(
59
      'class' => array('at-layout-form'),
60
    ),
61
  );
13 62

  
14
  // About here we need to call a custom sort function, this is what we got for now
15
  sort($options, SORT_STRING);
63
  // Bigscreen Layout
64
  $form['at-settings']['bigscreen']['bigscreen-layout-wrapper'] = array(
65
    '#type' => 'fieldset',
66
    '#title' => t('Choose sidebar layout'),
67
  );
16 68

  
17
  foreach ($options as $option) {
18
    if ($device_group === 'bigscreen') {
19
      $bigscreen_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option)); // human readable option names for accessibility
20
    }
21
    if ($device_group === 'tablet_landscape') {
22
      $tablet_landscape_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option));
23
    }
24
    if ($device_group === 'tablet_portrait') {
25
      $tablet_portrait_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option));
26
    }
27
    if ($device_group === 'smartphone_landscape') {
28
      $smartphone_landscape_options[$option] = drupal_ucfirst(str_replace('_', ' ', $option));
29
    }
30
  }
31
}
69
  // Options
70
  $form['at-settings']['bigscreen']['bigscreen-layout-wrapper']['bigscreen_layout'] = array(
71
    '#type' => 'radios',
72
    '#title' => t('<strong>Choose sidebar positions</strong>'),
73
    '#default_value' => str_replace('-', '_', at_get_setting('bigscreen_layout')), // avoid "illigal choice" errors in 7.x-2.x sub-themes.
74
    '#options' => $bigscreen_options,
75
  );
76

  
77
  // Sidebars
78
  $form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper'] = array(
79
    '#type' => 'fieldset',
80
    '#title' => t('Set sidebar widths'),
81
    '#description' => t('<strong>Set the width of each sidebar</strong>'),
82
  );
83

  
84
  // Units
85
  $form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_unit'] = array(
86
    '#type' => 'select',
87
    '#title' => t('Unit'),
88
    '#default_value' => at_get_setting('bigscreen_sidebar_unit'),
89
    '#options' => $unit_options,
90
  );
91

  
92
  // Sidebar first
93
  $form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_first'] = array(
94
    '#type' => 'textfield',
95
    '#title' => t('First sidebar'),
96
    '#default_value' => check_plain(at_get_setting('bigscreen_sidebar_first')),
97
    '#size' => 4,
98
    '#maxlenght' => 4,
99
    '#states' => array(
100
      'required' => array(
101
        array('input[name="bigscreen_layout"]' => array('value' => 'three_col_grail')),
102
        array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_left')),
103
        array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_right')),
104
      ),
105
    ),
106
  );
107

  
108
  // Sidebar second
109
  $form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_second'] = array(
110
    '#type' => 'textfield',
111
    '#title' => t('Second sidebar'),
112
    '#default_value' => check_plain(at_get_setting('bigscreen_sidebar_second')),
113
    '#size' => 4,
114
    '#maxlenght' => 4,
115
    '#states' => array(
116
      'required' => array(
117
        array('input[name="bigscreen_layout"]' => array('value' => 'three_col_grail')),
118
        array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_left')),
119
        array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_right')),
120
      ),
121
    ),
122
  );
123

  
124
  // Page width
125
  $form['at-settings']['bigscreen']['bigscreen-width-wrapper'] = array(
126
    '#type' => 'fieldset',
127
    '#title' => t('Set the page width'),
128
    '#description' => t('<strong>Set the page width</strong>'),
129
  );
130

  
131
  // Unit
132
  $form['at-settings']['bigscreen']['bigscreen-width-wrapper']['bigscreen_page_unit'] = array(
133
    '#type' => 'select',
134
    '#title' => t('Unit'),
135
    '#default_value' => at_get_setting('bigscreen_page_unit'),
136
    '#options' => $unit_options,
137
  );
138

  
139
  // Width
140
  $form['at-settings']['bigscreen']['bigscreen-width-wrapper']['bigscreen_page_width'] = array(
141
    '#type'  => 'textfield',
142
    '#title' => t('Page width'),
143
    '#default_value' => check_plain(at_get_setting('bigscreen_page_width')),
144
    '#size' => 4,
145
    '#maxlenght' => 4,
146
    '#required' => TRUE,
147
  );
32 148

  
33
// CSS for page layout icons
34
$page_layout_css_files = responsive_plugins_admin_css($theme_name, $plugin_type = 'page_layout');
35
foreach ($page_layout_css_files as $filepath) {
36
  if (file_exists($filepath)) {
37
    $page_layout_css['css'][] = array('type' => 'file', 'data' => $filepath, 'weight' => 100);
149
  // Max width
150
  $form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper'] = array(
151
    '#type' => 'fieldset',
152
    '#title' => t('Set a max width'),
153
    '#states' => array(
154
      'visible' => array('select[name="bigscreen_page_unit"]' => array('value' => '%')),
155
    ),
156
  );
157

  
158
  // Max width checkbox
159
  $form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_set_max_width'] = array(
160
    '#type' => 'checkbox',
161
    '#title' => t('Set a max width'),
162
    '#default_value' => at_get_setting('bigscreen_set_max_width'),
163
  );
164

  
165
  // Max width unit
166
  $form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_max_width_unit'] = array(
167
    '#type' => 'select',
168
    '#title' => t('Unit'),
169
    '#default_value' => at_get_setting('bigscreen_max_width_unit'),
170
    '#options' => array('px' => 'px', 'em' => 'em'),
171
    '#states' => array(
172
      'visible' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)),
173
    ),
174
  );
175

  
176
  // Max width value
177
  $form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_max_width'] = array(
178
    '#type'  => 'textfield',
179
    '#title' => t('Max width'),
180
    '#default_value' => check_plain(at_get_setting('bigscreen_max_width')),
181
    '#size' => 4,
182
    '#maxlenght' => 4,
183
    '#states' => array(
184
      'visible' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)),
185
      'required' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)),
186
    ),
187
  );
188

  
189
  // Media queries
190
  $form['at-settings']['bigscreen']['media-queries-wrapper'] = array(
191
    '#type' => 'fieldset',
192
    '#title' => t('Standard Screen Media Queries'),
193
    '#weight' => 1,
194
    '#attributes' => array(
195
      'class' => array('at-media-queries'),
196
    ),
197
  );
198

  
199
  // Media query
200
  $form['at-settings']['bigscreen']['media-queries-wrapper']['bigscreen_media_query'] = array(
201
    '#type' => 'textfield',
202
    '#title' => t('Media query for this layout'),
203
    '#default_value' => check_plain(at_get_setting('bigscreen_media_query')),
204
    '#description' => t('Do not include @media, it\'s included automatically.'),
205
    '#size' => 100,
206
    '#required' => TRUE,
207
  );
208

  
209
  /*****************************************************************************
210
   *
211
   * Tablet
212
   *
213
   ****************************************************************************/
214

  
215
  $form['at-settings']['tablet'] = array(
216
    '#type' => 'fieldset',
217
    '#title' => t('Tablet Layout'),
218
    '#description' => t('<h3>Tablet Layout</h3><p>Tablet devices such as iPad, Android and Windows tablets have two orientations - landscape and portrait, which can also be thought of as wide and narrow tablets. You can configure a different layout for each orientation.</p>'),
219
    '#attributes' => array(
220
      'class' => array('at-layout-form'),
221
    ),
222
  );
223

  
224
  // Disabled message
225
  if(at_get_setting('disable_responsive_styles') === 1) {
226
    $form['at-settings']['tablet']['disabled'] = array(
227
      '#markup' => '<div class="messages warning">' . $disable_message . '</div>',
228
    );
38 229
  }
39
}
40 230

  
41
// Unit options
42
$unit_options = array('%' => '%', 'px' => 'px', 'em' => 'em');
43

  
44
// Set a message for when responsive layout is turned off
45
$disable_message = t('<p>The responsive layout is disabled, only the Standard layout is now used.</p><p>To re-enable uncheck the "Disable responsive layout and styles" checkbox under the "Settings" tab.</p>');
46

  
47

  
48
/*****************************************************************************
49
 *
50
 * Bigscreen (standard-layout)
51
 *
52
 ****************************************************************************/
53

  
54
$form['at-settings']['bigscreen'] = array(
55
  '#type' => 'fieldset',
56
  '#title' => t('Standard Layout'),
57
  '#description' => t('<h3>Standard Layout</h3><p>The standard layout is for desktops, laptops and other large screen devices.'),
58
  '#attached' => $page_layout_css,
59
  '#attributes' => array(
60
    'class' => array('at-layout-form'),
61
  ),
62
);
63

  
64
// Bigscreen Layout
65
$form['at-settings']['bigscreen']['bigscreen-layout-wrapper'] = array(
66
  '#type' => 'fieldset',
67
  '#title' => t('Choose sidebar layout'),
68
);
69

  
70
// Options
71
$form['at-settings']['bigscreen']['bigscreen-layout-wrapper']['bigscreen_layout'] = array(
72
  '#type' => 'radios',
73
  '#title' => t('<strong>Choose sidebar positions</strong>'),
74
  '#default_value' => str_replace('-', '_', at_get_setting('bigscreen_layout')), // avoid "illigal choice" errors in 7.x-2.x sub-themes.
75
  '#options' => $bigscreen_options,
76
);
77

  
78
// Sidebars
79
$form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper'] = array(
80
  '#type' => 'fieldset',
81
  '#title' => t('Set sidebar widths'),
82
  '#description' => t('<strong>Set the width of each sidebar</strong>'),
83
);
84

  
85
// Units
86
$form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_unit'] = array(
87
  '#type' => 'select',
88
  '#title' => t('Unit'),
89
  '#default_value' => at_get_setting('bigscreen_sidebar_unit'),
90
  '#options' => $unit_options,
91
);
92

  
93
// Sidebar first
94
$form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_first'] = array(
95
  '#type' => 'textfield',
96
  '#title' => t('First sidebar'),
97
  '#default_value' => check_plain(at_get_setting('bigscreen_sidebar_first')),
98
  '#size' => 4,
99
  '#maxlenght' => 4,
100
  '#states' => array(
101
    'required' => array(
102
      array('input[name="bigscreen_layout"]' => array('value' => 'three_col_grail')),
103
      array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_left')),
104
      array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_right')),
231
  /*******************
232
   * Tablet landscape
233
   ******************/
234

  
235
  $form['at-settings']['tablet']['landscape'] = array(
236
    '#type' => 'fieldset',
237
    '#title' => t('Landscape'),
238
    '#description' => t('<h4>Landscape tablet <span class="field-description-info">(wide)</span></h4>'),
239
    '#states' => array(
240
      'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
105 241
    ),
106
  ),
107
);
108

  
109
// Sidebar second
110
$form['at-settings']['bigscreen']['bigscreen-sidebar-wrapper']['bigscreen_sidebar_second'] = array(
111
  '#type' => 'textfield',
112
  '#title' => t('Second sidebar'),
113
  '#default_value' => check_plain(at_get_setting('bigscreen_sidebar_second')),
114
  '#size' => 4,
115
  '#maxlenght' => 4,
116
  '#states' => array(
117
    'required' => array(
118
      array('input[name="bigscreen_layout"]' => array('value' => 'three_col_grail')),
119
      array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_left')),
120
      array('input[name="bigscreen_layout"]' => array('value' => 'two_sidebars_right')),
242
  );
243

  
244
  // Tablet landscape Layout options
245
  $form['at-settings']['tablet']['landscape']['tablet-landscape-layout-wrapper'] = array(
246
    '#type' => 'fieldset',
247
    '#title' => t('Choose sidebar layout'),
248
  );
249

  
250
  // Options
251
  $form['at-settings']['tablet']['landscape']['tablet-landscape-layout-wrapper']['tablet_landscape_layout'] = array(
252
    '#type' => 'radios',
253
    '#title' => t('<strong>Choose sidebar positions</strong>'),
254
    '#default_value' => str_replace('-', '_', at_get_setting('tablet_landscape_layout')),
255
    '#options' => $tablet_landscape_options,
256
  );
257

  
258
  // Sidebars
259
  $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper'] = array(
260
    '#type' => 'fieldset',
261
    '#title' => t('Set sidebar widths'),
262
    '#description' => t('<strong>Set the width of each sidebar</strong>'),
263
  );
264

  
265
  // Units
266
  $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_unit'] = array(
267
    '#type' => 'select',
268
    '#title' => t('Unit'),
269
    '#default_value' => at_get_setting('tablet_landscape_sidebar_unit'),
270
    '#options' => $unit_options,
271
  );
272

  
273
  // Sidebar first
274
  $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_first'] = array(
275
    '#type' => 'textfield',
276
    '#title' => t('First sidebar'),
277
    '#default_value' => check_plain(at_get_setting('tablet_landscape_sidebar_first')),
278
    '#size' => 4,
279
    '#maxlenght' => 4,
280
    '#states' => array(
281
      'required' => array(
282
        array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')),
283
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')),
284
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left_stack')),
285
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')),
286
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right_stack')),
287
      ),
121 288
    ),
122
  ),
123
);
124

  
125
// Page width
126
$form['at-settings']['bigscreen']['bigscreen-width-wrapper'] = array(
127
  '#type' => 'fieldset',
128
  '#title' => t('Set the page width'),
129
  '#description' => t('<strong>Set the page width</strong>'),
130
);
131

  
132
// Unit
133
$form['at-settings']['bigscreen']['bigscreen-width-wrapper']['bigscreen_page_unit'] = array(
134
  '#type' => 'select',
135
  '#title' => t('Unit'),
136
  '#default_value' => at_get_setting('bigscreen_page_unit'),
137
  '#options' => $unit_options,
138
);
139

  
140
// Width
141
$form['at-settings']['bigscreen']['bigscreen-width-wrapper']['bigscreen_page_width'] = array(
142
  '#type'  => 'textfield',
143
  '#title' => t('Page width'),
144
  '#default_value' => check_plain(at_get_setting('bigscreen_page_width')),
145
  '#size' => 4,
146
  '#maxlenght' => 4,
147
  '#required' => TRUE,
148
);
149

  
150
// Max width
151
$form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper'] = array(
152
  '#type' => 'fieldset',
153
  '#title' => t('Set a max width'),
154
  '#states' => array(
155
    'visible' => array('select[name="bigscreen_page_unit"]' => array('value' => '%')),
156
  ),
157
);
158

  
159
// Max width checkbox
160
$form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_set_max_width'] = array(
161
  '#type' => 'checkbox',
162
  '#title' => t('Set a max width'),
163
  '#default_value' => at_get_setting('bigscreen_set_max_width'),
164
);
165

  
166
// Max width unit
167
$form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_max_width_unit'] = array(
168
  '#type' => 'select',
169
  '#title' => t('Unit'),
170
  '#default_value' => at_get_setting('bigscreen_max_width_unit'),
171
  '#options' => array('px' => 'px', 'em' => 'em'),
172
  '#states' => array(
173
    'visible' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)),
174
  ),
175
);
176

  
177
// Max width value
178
$form['at-settings']['bigscreen']['bigscreen-maxwidth-wrapper']['bigscreen_max_width'] = array(
179
  '#type'  => 'textfield',
180
  '#title' => t('Max width'),
181
  '#default_value' => check_plain(at_get_setting('bigscreen_max_width')),
182
  '#size' => 4,
183
  '#maxlenght' => 4,
184
  '#states' => array(
185
    'visible' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)),
186
    'required' => array('input[name="bigscreen_set_max_width"]' => array('checked' => TRUE)),
187
  ),
188
);
189

  
190
// Media queries
191
$form['at-settings']['bigscreen']['media-queries-wrapper'] = array(
192
  '#type' => 'fieldset',
193
  '#title' => t('Standard Screen Media Queries'),
194
  '#weight' => 1,
195
  '#attributes' => array(
196
    'class' => array('at-media-queries'),
197
  ),
198
);
199

  
200
// Media query
201
$form['at-settings']['bigscreen']['media-queries-wrapper']['bigscreen_media_query'] = array(
202
  '#type' => 'textfield',
203
  '#title' => t('Media query for this layout'),
204
  '#default_value' => check_plain(at_get_setting('bigscreen_media_query')),
205
  '#description' => t('Do not include @media, it\'s included automatically.'),
206
  '#size' => 100,
207
  '#required' => TRUE,
208
);
209

  
210

  
211
/*****************************************************************************
212
 *
213
 * Tablet
214
 *
215
 ****************************************************************************/
216

  
217
$form['at-settings']['tablet'] = array(
218
  '#type' => 'fieldset',
219
  '#title' => t('Tablet Layout'),
220
  '#description' => t('<h3>Tablet Layout</h3><p>Tablet devices such as iPad have two orientations - landscape and portrait. You can configure a different layout for each orientation.</p>'),
221
  '#attributes' => array(
222
    'class' => array('at-layout-form'),
223
  ),
224
);
225

  
226
// Disabled message
227
if(at_get_setting('disable_responsive_styles') === 1) {
228
  $form['at-settings']['tablet']['disabled'] = array(
229
    '#markup' => '<div class="messages warning">' . $disable_message . '</div>',
230 289
  );
231
}
232 290

  
291
  // Sidebar second
292
  $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_second'] = array(
293
    '#type' => 'textfield',
294
    '#title' => t('Second sidebar'),
295
    '#default_value' => check_plain(at_get_setting('tablet_landscape_sidebar_second')),
296
    '#size' => 4,
297
    '#maxlenght' => 4,
298
    '#states' => array(
299
      'invisible' => array(
300
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left_stack')),
301
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right_stack')),
302
      ),
303
      'required' => array(
304
        array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')),
305
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')),
306
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')),
307
      ),
308
    ),
309
  );
233 310

  
234
/*******************
235
 * Tablet landscape
236
 ******************/
237

  
238
$form['at-settings']['tablet']['landscape'] = array(
239
  '#type' => 'fieldset',
240
  '#title' => t('Landscape'),
241
  '#description' => t('<h4>Landscape tablet</h4>'),
242
  '#states' => array(
243
    'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
244
  ),
245
);
246

  
247
// Tablet landscape Layout options
248
$form['at-settings']['tablet']['landscape']['tablet-landscape-layout-wrapper'] = array(
249
  '#type' => 'fieldset',
250
  '#title' => t('Choose sidebar layout'),
251
);
252

  
253
// Options
254
$form['at-settings']['tablet']['landscape']['tablet-landscape-layout-wrapper']['tablet_landscape_layout'] = array(
255
  '#type' => 'radios',
256
  '#title' => t('<strong>Choose sidebar positions</strong>'),
257
  '#default_value' => str_replace('-', '_', at_get_setting('tablet_landscape_layout')),
258
  '#options' => $tablet_landscape_options,
259
);
260

  
261
// Sidebars
262
$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper'] = array(
263
  '#type' => 'fieldset',
264
  '#title' => t('Set sidebar widths'),
265
  '#description' => t('<strong>Set the width of each sidebar</strong>'),
266
);
267

  
268
// Units
269
$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_unit'] = array(
270
  '#type' => 'select',
271
  '#title' => t('Unit'),
272
  '#default_value' => at_get_setting('tablet_landscape_sidebar_unit'),
273
  '#options' => $unit_options,
274
);
275

  
276
// Sidebar first
277
$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_first'] = array(
278
  '#type' => 'textfield',
279
  '#title' => t('First sidebar'),
280
  '#default_value' => check_plain(at_get_setting('tablet_landscape_sidebar_first')),
281
  '#size' => 4,
282
  '#maxlenght' => 4,
283
  '#states' => array(
284
    'required' => array(
285
      array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')),
286
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')),
287
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left_stack')),
288
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')),
289
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right_stack')),
311
  // Conditional messages for sidebar layouts
312
  $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet-landscape-sidebar-message-wrapper'] = array(
313
    '#type' => 'fieldset',
314
    '#states' => array(
315
      'invisible' => array(
316
        array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')),
317
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')),
318
        array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')),
319
      ),
290 320
    ),
291
  ),
292
);
293

  
294
// Sidebar second
295
$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet_landscape_sidebar_second'] = array(
296
  '#type' => 'textfield',
297
  '#title' => t('Second sidebar'),
298
  '#default_value' => check_plain(at_get_setting('tablet_landscape_sidebar_second')),
299
  '#size' => 4,
300
  '#maxlenght' => 4,
301
  '#states' => array(
302
    'invisible' => array(
303
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left_stack')),
304
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right_stack')),
321
  );
322
  $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet-landscape-sidebar-message-wrapper']['message'] = array(
323
    '#markup' => t('<div class="description">In this layout <em>Second sidebar</em> wraps below.</div>'),
324
  );
325

  
326
  // Page width
327
  $form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper'] = array(
328
    '#type' => 'fieldset',
329
    '#title' => t('Set the page width'),
330
    '#description' => t('<strong>Set the page width</strong>'),
331
  );
332

  
333
  // Unit
334
  $form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper']['tablet_landscape_page_unit'] = array(
335
    '#type' => 'select',
336
    '#title' => t('Unit'),
337
    '#default_value' => at_get_setting('tablet_landscape_page_unit'),
338
    '#options' => $unit_options,
339
  );
340

  
341
  // Width
342
  $form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper']['tablet_landscape_page_width'] = array(
343
    '#type'  => 'textfield',
344
    '#title' => t('Page width'),
345
    '#default_value' => check_plain(at_get_setting('tablet_landscape_page_width')),
346
    '#size' => 4,
347
    '#maxlenght' => 4,
348
    '#required' => TRUE,
349
  );
350

  
351
  // Media Queries
352
  $form['at-settings']['tablet']['landscape']['tablet-landscape-media-queries-wrapper'] = array(
353
    '#type' => 'fieldset',
354
    '#title' => t('Tablet Landscape Media Queries'),
355
    '#weight' => 1,
356
    '#attributes' => array(
357
      'class' => array(
358
        'at-media-queries',
359
      ),
305 360
    ),
306
    'required' => array(
307
      array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')),
308
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')),
309
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')),
361
  );
362

  
363
  // Media query
364
  $form['at-settings']['tablet']['landscape']['tablet-landscape-media-queries-wrapper']['tablet_landscape_media_query'] = array(
365
    '#type' => 'textfield',
366
    '#title' => t('Media query for this layout'),
367
    '#default_value' => check_plain(at_get_setting('tablet_landscape_media_query')),
368
    '#description' => t('Do not include @media, it\'s included automatically.'),
369
    '#size' => 100,
370
    '#required' => TRUE,
371
  );
372

  
373

  
374
  /******************
375
   * Tablet portrait
376
   *****************/
377

  
378
  $form['at-settings']['tablet']['portrait'] = array(
379
    '#type' => 'fieldset',
380
    '#title' => t('Portrait'),
381
    '#description' => t('<h4>Portrait tablet <span class="field-description-info">(narrow)</span></h4>'),
382
    '#states' => array(
383
      'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
310 384
    ),
311
  ),
312
);
313

  
314
// Conditional messages for sidebar layouts
315
$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet-landscape-sidebar-message-wrapper'] = array(
316
  '#type' => 'fieldset',
317
  '#states' => array(
318
    'invisible' => array(
319
      array('input[name="tablet_landscape_layout"]' => array('value' => 'three_col_grail')),
320
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_left')),
321
      array('input[name="tablet_landscape_layout"]' => array('value' => 'two_sidebars_right')),
385
  );
386

  
387
  // Tablet portrait Layout options
388
  $form['at-settings']['tablet']['portrait']['tablet-portrait-layout-wrapper'] = array(
389
    '#type' => 'fieldset',
390
    '#title' => t('Choose sidebar layout'),
391
  );
392

  
393
  // Options
394
  $form['at-settings']['tablet']['portrait']['tablet-portrait-layout-wrapper']['tablet_portrait_layout'] = array(
395
    '#type' => 'radios',
396
    '#title' => t('<strong>Choose sidebar positions</strong>'),
397
    '#default_value' => str_replace('-', '_', at_get_setting('tablet_portrait_layout')),
398
    '#options' => $tablet_portrait_options,
399
  );
400

  
401
  // Tablet portrait Sidebars
402
  $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper'] = array(
403
    '#type' => 'fieldset',
404
    '#title' => t('Set sidebar widths'),
405
    '#description' => t('<strong>Set the width of each sidebar</strong>'),
406
    '#states' => array(
407
      'invisible' => array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')),
322 408
    ),
323
  ),
324
);
325
$form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet-landscape-sidebar-message-wrapper']['message'] = array(
326
  '#markup' => t('<div class="description">In this layout <em>Second sidebar</em> wraps below.</div>'),
327
);
328

  
329
// Page width
330
$form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper'] = array(
331
  '#type' => 'fieldset',
332
  '#title' => t('Set the page width'),
333
  '#description' => t('<strong>Set the page width</strong>'),
334
);
335

  
336
// Unit
337
$form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper']['tablet_landscape_page_unit'] = array(
338
  '#type' => 'select',
339
  '#title' => t('Unit'),
340
  '#default_value' => at_get_setting('tablet_landscape_page_unit'),
341
  '#options' => $unit_options,
342
);
343

  
344
// Width
345
$form['at-settings']['tablet']['landscape']['tablet-landscape-page-width-wrapper']['tablet_landscape_page_width'] = array(
346
  '#type'  => 'textfield',
347
  '#title' => t('Page width'),
348
  '#default_value' => check_plain(at_get_setting('tablet_landscape_page_width')),
349
  '#size' => 4,
350
  '#maxlenght' => 4,
351
  '#required' => TRUE,
352
);
353

  
354
// Media Queries
355
$form['at-settings']['tablet']['landscape']['tablet-landscape-media-queries-wrapper'] = array(
356
  '#type' => 'fieldset',
357
  '#title' => t('Tablet Landscape Media Queries'),
358
  '#weight' => 1,
359
  '#attributes' => array(
360
    'class' => array(
361
      'at-media-queries',
409
  );
410

  
411
  // Units
412
  $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_unit'] = array(
413
    '#type' => 'select',
414
    '#title' => t('Unit'),
415
    '#default_value' => at_get_setting('tablet_portrait_sidebar_unit'),
416
    '#options' => $unit_options,
417
  );
418

  
419
  // Sidebar first
420
  $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_first'] = array(
421
    '#type' => 'textfield',
422
    '#title' => t('First sidebar'),
423
    '#default_value' => check_plain(at_get_setting('tablet_portrait_sidebar_first')),
424
    '#size' => 4,
425
    '#maxlenght' => 4,
426
    '#states' => array(
427
      'invisible' => array(
428
        array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')),
429
      ),
430
      'required' => array(
431
        array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')),
432
        array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_left_stack')),
433
        array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_right_stack')),
434
      ),
362 435
    ),
363
  ),
364
);
365

  
366
// Media query
367
$form['at-settings']['tablet']['landscape']['tablet-landscape-media-queries-wrapper']['tablet_landscape_media_query'] = array(
368
  '#type' => 'textfield',
369
  '#title' => t('Media query for this layout'),
370
  '#default_value' => check_plain(at_get_setting('tablet_landscape_media_query')),
371
  '#description' => t('Do not include @media, it\'s included automatically.'),
372
  '#size' => 100,
373
  '#required' => TRUE,
374
);
375

  
376

  
377
/******************
378
 * Tablet portrait
379
 *****************/
380

  
381
$form['at-settings']['tablet']['portrait'] = array(
382
  '#type' => 'fieldset',
383
  '#title' => t('Portrait'),
384
  '#description' => t('<h4>Portrait tablet</h4>'),
385
  '#states' => array(
386
    'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
387
  ),
388
);
389

  
390
// Tablet portrait Layout options
391
$form['at-settings']['tablet']['portrait']['tablet-portrait-layout-wrapper'] = array(
392
  '#type' => 'fieldset',
393
  '#title' => t('Choose sidebar layout'),
394
);
395

  
396
// Options
397
$form['at-settings']['tablet']['portrait']['tablet-portrait-layout-wrapper']['tablet_portrait_layout'] = array(
398
  '#type' => 'radios',
399
  '#title' => t('<strong>Choose sidebar positions</strong>'),
400
  '#default_value' => str_replace('-', '_', at_get_setting('tablet_portrait_layout')),
401
  '#options' => $tablet_portrait_options,
402
);
403

  
404
// Tablet portrait Sidebars
405
$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper'] = array(
406
  '#type' => 'fieldset',
407
  '#title' => t('Set sidebar widths'),
408
  '#description' => t('<strong>Set the width of each sidebar</strong>'),
409
  '#states' => array(
410
    'invisible' => array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')),
411
  ),
412
);
413

  
414
// Units
415
$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_unit'] = array(
416
  '#type' => 'select',
417
  '#title' => t('Unit'),
418
  '#default_value' => at_get_setting('tablet_portrait_sidebar_unit'),
419
  '#options' => $unit_options,
420
);
421

  
422
// Sidebar first
423
$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_first'] = array(
424
  '#type' => 'textfield',
425
  '#title' => t('First sidebar'),
426
  '#default_value' => check_plain(at_get_setting('tablet_portrait_sidebar_first')),
427
  '#size' => 4,
428
  '#maxlenght' => 4,
429
  '#states' => array(
430
    'invisible' => array(
431
      array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')),
436
  );
437

  
438
  // Sidebar second
439
  $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_second'] = array(
440
    '#type' => 'textfield',
441
    '#title' => t('Second sidebar'),
442
    '#default_value' => check_plain(at_get_setting('tablet_portrait_sidebar_second')),
443
    '#size' => 4,
444
    '#maxlenght' => 4,
445
    '#states' => array(
446
      'invisible' => array(
447
        array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')),
448
        array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_left_stack')),
449
        array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_right_stack')),
450
      ),
451
      'required' => array(
452
        array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')),
453
      ),
432 454
    ),
433
    'required' => array(
434
      array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')),
435
      array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_left_stack')),
436
      array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_right_stack')),
455
  );
456

  
457
  // Conditional messages for sidebar layouts
458
  $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet-portrait-sidebar-message-wrapper'] = array(
459
    '#type' => 'fieldset',
460
    '#states' => array(
461
      'invisible' => array(
462
        array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')),
463
        array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')),
464
      ),
437 465
    ),
438
  ),
439
);
440

  
441
// Sidebar second
442
$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet_portrait_sidebar_second'] = array(
443
  '#type' => 'textfield',
444
  '#title' => t('Second sidebar'),
445
  '#default_value' => check_plain(at_get_setting('tablet_portrait_sidebar_second')),
446
  '#size' => 4,
447
  '#maxlenght' => 4,
448
  '#states' => array(
449
    'invisible' => array(
450
      array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')),
451
      array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_left_stack')),
452
      array('input[name="tablet_portrait_layout"]' => array('value' => 'two_sidebars_right_stack')),
466
  );
467
  $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet-portrait-sidebar-message-wrapper']['message'] = array(
468
    '#markup' => t('<div class="description">In this layout <em>Second sidebar</em> wraps below.</div>'),
469
  );
470

  
471
  // Tablet portrait Page width
472
  $form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper'] = array(
473
    '#type' => 'fieldset',
474
    '#title' => t('Set the page width'),
475
    '#description' => t('<strong>Set the page width</strong>'),
476
  );
477

  
478
  // Unit
479
  $form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper']['tablet_portrait_page_unit'] = array(
480
    '#type' => 'select',
481
    '#title' => t('Unit'),
482
    '#default_value' => at_get_setting('tablet_portrait_page_unit'),
483
    '#options' => $unit_options,
484
  );
485

  
486
  // Width
487
  $form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper']['tablet_portrait_page_width'] = array(
488
    '#type'  => 'textfield',
489
    '#title' => t('Page width'),
490
    '#default_value' => check_plain(at_get_setting('tablet_portrait_page_width')),
491
    '#size' => 4,
492
    '#maxlenght' => 4,
493
    '#required' => TRUE,
494
  );
495

  
496
  // Tablet portrait Media queries
497
  $form['at-settings']['tablet']['portrait']['tablet-portrait-media-queries-wrapper'] = array(
498
    '#type' => 'fieldset',
499
    '#title' => t('Tablet Portrait Media Queries'),
500
    '#weight' => 1,
501
    '#attributes' => array(
502
      'class' => array('at-media-queries'),
453 503
    ),
454
    'required' => array(
455
      array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')),
504
  );
505

  
506
  // Media query
507
  $form['at-settings']['tablet']['portrait']['tablet-portrait-media-queries-wrapper']['tablet_portrait_media_query'] = array(
508
    '#type' => 'textfield',
509
    '#title' => t('Media query for this layout'),
510
    '#default_value' => check_plain(at_get_setting('tablet_portrait_media_query')),
511
    '#description' => t('Do not include @media, it\'s included automatically.'),
512
    '#size' => 100,
513
    '#required' => TRUE,
514
  );
515

  
516

  
517
  /*****************************************************************************
518
   *
519
   * Smalltouch
520
   *
521
   ****************************************************************************/
522

  
523
  $form['at-settings']['smalltouch'] = array(
524
    '#type' => 'fieldset',
525
    '#title' => t('Smalltouch Layout'),
526
    '#description' => t('<h3>Smalltouch Layout</h3><p>Smalltouch devices such as iPhone, Android and Windows phones have two orientations - landscape and portrait, which can also be thought of as wide and arrow smalltouch devices. You can configure a layout for landscape orientation only - portrait orientation (narrow) will always display in one column (all regions full width and stacked) with sidebars below the main content.</p>'),
527
    '#attributes' => array(
528
      'class' => array('at-layout-form'),
456 529
    ),
457
  ),
458
);
459

  
460
// Conditional messages for sidebar layouts
461
$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet-portrait-sidebar-message-wrapper'] = array(
462
  '#type' => 'fieldset',
463
  '#states' => array(
464
    'invisible' => array(
465
      array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_vert')),
466
      array('input[name="tablet_portrait_layout"]' => array('value' => 'one_col_stack')),
530
  );
531

  
532
  // Disabled message
533
  if(at_get_setting('disable_responsive_styles') === 1) {
534
    $form['at-settings']['smalltouch']['disabled'] = array(
535
      '#markup' => '<div class="messages warning">' . $disable_message . '</div>',
536
    );
537
  }
538

  
539
  /***********************
540
   * Smalltouch landscape
541
   **********************/
542

  
543
  $form['at-settings']['smalltouch']['landscape'] = array(
544
    '#type' => 'fieldset',
545
    '#title' => t('Landscape'),
546
    '#description' => t('<h4>Landscape smalltouch <span class="field-description-info">(wide)</span></h4>'),
547
    '#states' => array(
548
      'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
467 549
    ),
468
  ),
469
);
470
$form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet-portrait-sidebar-message-wrapper']['message'] = array(
471
  '#markup' => t('<div class="description">In this layout <em>Second sidebar</em> wraps below.</div>'),
472
);
473

  
474
// Tablet portrait Page width
475
$form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper'] = array(
476
  '#type' => 'fieldset',
477
  '#title' => t('Set the page width'),
478
  '#description' => t('<strong>Set the page width</strong>'),
479
);
480

  
481
// Unit
482
$form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper']['tablet_portrait_page_unit'] = array(
483
  '#type' => 'select',
484
  '#title' => t('Unit'),
485
  '#default_value' => at_get_setting('tablet_portrait_page_unit'),
486
  '#options' => $unit_options,
487
);
488

  
489
// Width
490
$form['at-settings']['tablet']['portrait']['tablet-portrait-page-width-wrapper']['tablet_portrait_page_width'] = array(
491
  '#type'  => 'textfield',
492
  '#title' => t('Page width'),
493
  '#default_value' => check_plain(at_get_setting('tablet_portrait_page_width')),
494
  '#size' => 4,
495
  '#maxlenght' => 4,
496
  '#required' => TRUE,
497
);
498

  
499

  
500
// Tablet portrait Media queries
501
$form['at-settings']['tablet']['portrait']['tablet-portrait-media-queries-wrapper'] = array(
502
  '#type' => 'fieldset',
503
  '#title' => t('Tablet Portrait Media Queries'),
504
  '#weight' => 1,
505
  '#attributes' => array(
506
    'class' => array('at-media-queries'),
507
  ),
508
);
509

  
510
// Media query
511
$form['at-settings']['tablet']['portrait']['tablet-portrait-media-queries-wrapper']['tablet_portrait_media_query'] = array(
512
  '#type' => 'textfield',
513
  '#title' => t('Media query for this layout'),
514
  '#default_value' => check_plain(at_get_setting('tablet_portrait_media_query')),
515
  '#description' => t('Do not include @media, it\'s included automatically.'),
516
  '#size' => 100,
517
  '#required' => TRUE,
518
);
519

  
520

  
521
/*****************************************************************************
522
 *
523
 * Smartphone
524
 *
525
 ****************************************************************************/
526

  
527
$form['at-settings']['smartphone'] = array(
528
  '#type' => 'fieldset',
529
  '#title' => t('Smartphone Layout'),
530
  '#description' => t('<h3>Smartphone Layout</h3><p>Smartphone devices such as iPhone, Android and Windows phones have two orientations - landscape and portrait. You can configure a layout for landscape orientation only - portrait orientation always displays in one column with sidebars stacked below the main content.</p>'),
531
  '#attributes' => array(
532
    'class' => array('at-layout-form'),
533
  ),
534
);
535

  
536
// Disabled message
537
if(at_get_setting('disable_responsive_styles') === 1) {
538
  $form['at-settings']['smartphone']['disabled'] = array(
539
    '#markup' => '<div class="messages warning">' . $disable_message . '</div>',
540 550
  );
541
}
542 551

  
552
  $form['at-settings']['smalltouch']['landscape']['smalltouch-landscape-layout-wrapper'] = array(
553
    '#type' => 'fieldset',
554
    '#title' => t('Choose sidebar layout'),
555
  );
556

  
557
  $form['at-settings']['smalltouch']['landscape']['smalltouch-landscape-layout-wrapper']['smalltouch_landscape_layout'] = array(
558
    '#type' => 'radios',
559
    '#title' => t('<strong>Choose sidebar positions</strong>'),
560
    '#default_value' => at_get_setting('smalltouch_landscape_layout') ? str_replace('-', '_', at_get_setting('smalltouch_landscape_layout')) : str_replace('-', '_', at_get_setting('smartphone_landscape_layout')),
561
    '#options' => $smalltouch_landscape_options,
562
  );
563

  
564
  $form['at-settings']['smalltouch']['landscape']['smalltouch-landscape-sidebar-width-wrapper'] = array(
565
    '#type' => 'fieldset',
566
    '#title' => t('Set sidebar widths'),
567
    '#description' => t('<strong>Set the width of each sidebar</strong>'),
568
    '#states' => array(
569
      '!visible' => array('input[name="smalltouch_landscape_layout"]' => array('value' => 'one_col_stack')),
570
    ),
571
  );
572

  
573
  $form['at-settings']['smalltouch']['landscape']['smalltouch-landscape-sidebar-width-wrapper']['smalltouch_landscape_sidebar_unit'] = array(
574
    '#type' => 'select',
575
    '#title' => t('Unit'),
576
    '#default_value' => at_get_setting('smalltouch_landscape_sidebar_unit') ? at_get_setting('smalltouch_landscape_sidebar_unit') : at_get_setting('smartphone_landscape_sidebar_unit'),
577
    '#options' => $unit_options,
578
  );
579

  
580
  $form['at-settings']['smalltouch']['landscape']['smalltouch-landscape-sidebar-width-wrapper']['smalltouch_landscape_sidebar_first'] = array(
581
    '#type' => 'textfield',
582
    '#title' => t('First sidebar'),
583
    '#default_value' => at_get_setting('smalltouch_landscape_sidebar_first') ? check_plain(at_get_setting('smalltouch_landscape_sidebar_first')) : check_plain(at_get_setting('smartphone_landscape_sidebar_first')),
584
    '#size' => 4,
585
    '#maxlenght' => 4,
586
    '#states' => array(
587
      'required' => array('input[name="smalltouch_landscape_layout"]' => array('value' => 'one_col_vert')),
588
    ),
589
  );
590

  
591
  $form['at-settings']['smalltouch']['landscape']['smalltouch-landscape-sidebar-width-wrapper']['smalltouch_landscape_sidebar_second'] = array(
592
    '#type' => 'textfield',
593
    '#title' => t('Second sidebar'),
594
    '#default_value' => at_get_setting('smalltouch_landscape_sidebar_second') ? check_plain(at_get_setting('smalltouch_landscape_sidebar_second')) : check_plain(at_get_setting('smartphone_landscape_sidebar_second')),
595
    '#size' => 4,
596
    '#maxlenght' => 4,
597
    '#states' => array(
598
      'required' => array('input[name="smalltouch_landscape_layout"]' => array('value' => 'one_col_vert')),
599
    ),
600
  );
543 601

  
544
/***********************
545
 * Smartphone landscape
546
 **********************/
547

  
548
$form['at-settings']['smartphone']['landscape'] = array(
549
  '#type' => 'fieldset',
550
  '#title' => t('Landscape'),
551
  '#description' => t('<h4>Landscape smartphone</h4>'),
552
  '#states' => array(
553
    'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
554
  ),
555
);
556

  
557
$form['at-settings']['smartphone']['landscape']['smartphone-landscape-layout-wrapper'] = array(
558
  '#type' => 'fieldset',
559
  '#title' => t('Choose sidebar layout'),
560
);
561

  
562
$form['at-settings']['smartphone']['landscape']['smartphone-landscape-layout-wrapper']['smartphone_landscape_layout'] = array(
563
  '#type' => 'radios',
564
  '#title' => t('<strong>Choose sidebar positions</strong>'),
565
  '#default_value' => str_replace('-', '_', at_get_setting('smartphone_landscape_layout')),
566
  '#options' => $smartphone_landscape_options,
567
);
568

  
569
$form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper'] = array(
570
  '#type' => 'fieldset',
571
  '#title' => t('Set sidebar widths'),
572
  '#description' => t('<strong>Set the width of each sidebar</strong>'),
573
  '#states' => array(
574
    '!visible' => array('input[name="smartphone_landscape_layout"]' => array('value' => 'one_col_stack')),
575
  ),
576
);
577

  
578
$form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper']['smartphone_landscape_sidebar_unit'] = array(
579
  '#type' => 'select',
580
  '#title' => t('Unit'),
581
  '#default_value' => at_get_setting('smartphone_landscape_sidebar_unit'),
582
  '#options' => $unit_options,
583
);
584

  
585
$form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper']['smartphone_landscape_sidebar_first'] = array(
586
  '#type' => 'textfield',
587
  '#title' => t('First sidebar'),
588
  '#default_value' => check_plain(at_get_setting('smartphone_landscape_sidebar_first')),
589
  '#size' => 4,
590
  '#maxlenght' => 4,
591
  '#states' => array(
592
    'required' => array('input[name="smartphone_landscape_layout"]' => array('value' => 'one_col_vert')),
593
  ),
594
);
595

  
596
$form['at-settings']['smartphone']['landscape']['smartphone-landscape-sidebar-width-wrapper']['smartphone_landscape_sidebar_second'] = array(
597
  '#type' => 'textfield',
598
  '#title' => t('Second sidebar'),
599
  '#default_value' => check_plain(at_get_setting('smartphone_landscape_sidebar_second')),
600
  '#size' => 4,
601
  '#maxlenght' => 4,
602
  '#states' => array(
603
    'required' => array('input[name="smartphone_landscape_layout"]' => array('value' => 'one_col_vert')),
604
  ),
605
);
606

  
607
$form['at-settings']['smartphone']['landscape']['smartphone-landscape-media-queries-wrapper'] = array(
608
  '#type' => 'fieldset',
609
  '#title' => t('Smartphone Landscape Media Queries'),
610
  '#weight' => 1,
611
  '#attributes' => array(
612
    'class' => array('at-media-queries'),
613
  ),
614
);
615

  
616
$form['at-settings']['smartphone']['landscape']['smartphone-landscape-media-queries-wrapper']['smartphone_landscape_media_query'] = array(
617
  '#type' => 'textfield',
618
  '#title' => t('Media query for this layout'),
619
  '#default_value' => check_plain(at_get_setting('smartphone_landscape_media_query')),
620
  '#description' => t('Do not include @media, it\'s included automatically.'),
621
  '#size' => 100,
622
  '#required' => TRUE,
623
);
624

  
625
// Pass hidden values to the sumbit function, these values are required but the user can't change them via the UI
626
$form['at-settings']['smartphone']['landscape']['hidden']['smartphone_landscape_page_width'] = array(
627
  '#type' => 'hidden',
628
  '#default_value' => check_plain(at_get_setting('smartphone_landscape_page_width')),
629
);
630
$form['at-settings']['smartphone']['landscape']['hidden']['smartphone_landscape_page_unit'] = array(
631
  '#type' => 'hidden',
632
  '#default_value' => at_get_setting('smartphone_landscape_page_unit'),
633
);
634

  
635

  
636
/**********************
637
 * Smartphone portrait
638
 *********************/
639

  
640
$form['at-settings']['smartphone']['portrait'] = array(
641
  '#type' => 'fieldset',
642
  '#title' => t('Portrait'),
643
  '#description' => t('<h4>Portrait smartphone</h4><div class="smartphone-portrait-layout">One column</div><p>The smartphone portrait layout always displays in one column with sidebars stacked horizontally below the main content. All widths are always 100%.</p>'),
644
  '#states' => array(
645
    'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
646
  ),
647
);
648

  
649
$form['at-settings']['smartphone']['portrait']['smartphone-portrait-media-queries-wrapper'] = array(
650
  '#type' => 'fieldset',
651
  '#title' => t('Smartphone Portrait Media Queries'),
652
  '#weight' => 1,
653
  '#attributes' => array(
654
    'class' => array('at-media-queries'),
655
  ),
656
);
657

  
658
$form['at-settings']['smartphone']['portrait']['smartphone-portrait-media-queries-wrapper']['smartphone_portrait_media_query'] = array(
659
  '#type' => 'textfield',
660
  '#title' => t('Media query for this layout'),
661
  '#default_value' => check_plain(at_get_setting('smartphone_portrait_media_query')),
662
  '#description' => t('Do not include @media, it\'s included automatically.'),
663
  '#size' => 100,
664
);
665

  
666
// Pass hidden values to the sumbit function, these values are required but the user can't change them via the UI
667
$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_page_width'] = array(
668
  '#type' => 'hidden',
669
  '#default_value' => check_plain(at_get_setting('smartphone_portrait_page_width')),
670
);
671

  
672
$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_page_unit'] = array(
673
  '#type' => 'hidden',
674
  '#default_value' => at_get_setting('smartphone_portrait_page_unit'),
675
);
676

  
677
$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_sidebar_first'] = array(
678
  '#type' => 'hidden',
679
  '#default_value' => check_plain(at_get_setting('smartphone_portrait_sidebar_first')),
680
);
681

  
682
$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_sidebar_second'] = array(
683
  '#type' => 'hidden',
684
  '#default_value' => check_plain(at_get_setting('smartphone_portrait_sidebar_second')),
685
);
686

  
687
$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_sidebar_unit'] = array(
688
  '#type' => 'hidden',
689
  '#default_value' => check_plain(at_get_setting('smartphone_portrait_sidebar_unit')),
690
);
691

  
692
$form['at-settings']['smartphone']['portrait']['hidden']['smartphone_portrait_layout'] = array(
693
  '#type' => 'hidden',
694
  '#default_value' => str_replace('-', '_', at_get_setting('smartphone_portrait_layout')),
695
);
602
  $form['at-settings']['smalltouch']['landscape']['smalltouch-landscape-media-queries-wrapper'] = array(
603
    '#type' => 'fieldset',
604
    '#title' => t('Smalltouch Landscape Media Queries'),
605
    '#weight' => 1,
606
    '#attributes' => array(
607
      'class' => array('at-media-queries'),
608
    ),
609
  );
610

  
611
  $form['at-settings']['smalltouch']['landscape']['smalltouch-landscape-media-queries-wrapper']['smalltouch_landscape_media_query'] = array(
612
    '#type' => 'textfield',
613
    '#title' => t('Media query for this layout'),
614
    '#default_value' => at_get_setting('smalltouch_landscape_media_query') ? check_plain(at_get_setting('smalltouch_landscape_media_query')) : check_plain(at_get_setting('smartphone_landscape_media_query')),
615
    '#description' => t('Do not include @media, it\'s included automatically.'),
616
    '#size' => 100,
617
    //'#required' => TRUE,
618
  );
619

  
620
  // Pass hidden values to the sumbit function, these values are required but the user can't change them via the UI
621
  $form['at-settings']['smalltouch']['landscape']['hidden']['smalltouch_landscape_page_width'] = array(
622
    '#type' => 'hidden',
623
    '#default_value' => at_get_setting('smalltouch_landscape_page_width') ? check_plain(at_get_setting('smalltouch_landscape_page_width')) : check_plain(at_get_setting('smartphone_landscape_page_width')),
624
  );
625
  $form['at-settings']['smalltouch']['landscape']['hidden']['smalltouch_landscape_page_unit'] = array(
626
    '#type' => 'hidden',
627
    '#default_value' => at_get_setting('smalltouch_landscape_page_unit') ? at_get_setting('smalltouch_landscape_page_unit') : at_get_setting('smartphone_landscape_page_unit'),
628
  );
629

  
630
  /**********************
631
   * Smalltouch portrait
632
   *********************/
633

  
634
  $form['at-settings']['smalltouch']['portrait'] = array(
635
    '#type' => 'fieldset',
636
    '#title' => t('Portrait'),
637
    '#description' => t('<h4>Portrait smalltouch <span class="field-description-info">(narrow)</span></h4><div class="smalltouch-portrait-layout">One column</div><p>The smalltouch portrait layout always displays in one column with sidebars stacked horizontally below the main content. All widths are always 100%.</p>'),
638
    '#states' => array(
639
      'disabled' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
640
    ),
641
  );
642

  
643
  $form['at-settings']['smalltouch']['portrait']['smalltouch-portrait-media-queries-wrapper'] = array(
644
    '#type' => 'fieldset',
645
    '#title' => t('Smalltouch Portrait Media Queries'),
646
    '#weight' => 1,
647
    '#attributes' => array(
648
      'class' => array('at-media-queries'),
649
    ),
650
  );
651

  
652
  $form['at-settings']['smalltouch']['portrait']['smalltouch-portrait-media-queries-wrapper']['smalltouch_portrait_media_query'] = array(
653
    '#type' => 'textfield',
654
    '#title' => t('Media query for this layout'),
655
    '#default_value' => at_get_setting('smalltouch_portrait_media_query') ? check_plain(at_get_setting('smalltouch_portrait_media_query')) : check_plain(at_get_setting('smartphone_portrait_media_query')),
656
    '#description' => t('Do not include @media, it\'s included automatically.'),
657
    '#size' => 100,
658
  );
659

  
660
  // Pass hidden values to the sumbit function, these values are required but the user can't change them via the UI
661
  $form['at-settings']['smalltouch']['portrait']['hidden']['smalltouch_portrait_page_width'] = array(
662
    '#type' => 'hidden',
663
    '#default_value' => at_get_setting('smalltouch_portrait_page_width') ? check_plain(at_get_setting('smalltouch_portrait_page_width')) : check_plain(at_get_setting('smartphone_portrait_page_width')),
664
  );
665

  
666
  $form['at-settings']['smalltouch']['portrait']['hidden']['smalltouch_portrait_page_unit'] = array(
667
    '#type' => 'hidden',
668
    '#default_value' => at_get_setting('smalltouch_portrait_page_unit') ? at_get_setting('smalltouch_portrait_page_unit') : at_get_setting('smartphone_portrait_page_unit'),
669
  );
670

  
671
  $form['at-settings']['smalltouch']['portrait']['hidden']['smalltouch_portrait_sidebar_first'] = array(
672
    '#type' => 'hidden',
673
    '#default_value' => at_get_setting('smalltouch_portrait_sidebar_first') ? check_plain(at_get_setting('smalltouch_portrait_sidebar_first')) : check_plain(at_get_setting('smartphone_portrait_sidebar_first')),
674
  );
675

  
676
  $form['at-settings']['smalltouch']['portrait']['hidden']['smalltouch_portrait_sidebar_second'] = array(
677
    '#type' => 'hidden',
678
    '#default_value' => at_get_setting('smalltouch_portrait_sidebar_second') ? check_plain(at_get_setting('smalltouch_portrait_sidebar_second')) : check_plain(at_get_setting('smartphone_portrait_sidebar_second')),
679
  );
680

  
681
  $form['at-settings']['smalltouch']['portrait']['hidden']['smalltouch_portrait_sidebar_unit'] = array(
682
    '#type' => 'hidden',
683
    '#default_value' => at_get_setting('smalltouch_portrait_sidebar_unit') ? check_plain(at_get_setting('smalltouch_portrait_sidebar_unit')) : check_plain(at_get_setting('smartphone_portrait_sidebar_unit')),
684
  );
685

  
686
  $form['at-settings']['smalltouch']['portrait']['hidden']['smalltouch_portrait_layout'] = array(
687
    '#type' => 'hidden',
688
    '#default_value' => at_get_setting('smalltouch_portrait_layout') ? str_replace('-', '_', at_get_setting('smalltouch_portrait_layout')) : str_replace('-', '_', at_get_setting('smartphone_portrait_layout')),
689
  );
690
}

Formats disponibles : Unified diff