Projet

Général

Profil

Paste
Télécharger (29,1 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / adaptivetheme / at_core / inc / forms / settings.pagelayout.inc @ 5024cef7

1
<?php
2

    
3
/**
4
 * @file
5
 * Generate form elments for the Page Layout settings.
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
  }
32

    
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
  }
40

    
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
  );
62

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

    
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
  );
148

    
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
    );
229
  }
230

    
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)),
241
    ),
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
      ),
288
    ),
289
  );
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
  );
310

    
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
      ),
320
    ),
321
  );
322
  $form['at-settings']['tablet']['landscape']['tablet-landscape-sidebar-width-wrapper']['tablet-landscape-sidebar-message-wrapper']['message'] = array(
323
    '#markup' => '<div class="description">' . t('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
      ),
360
    ),
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)),
384
    ),
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')),
408
    ),
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
      ),
435
    ),
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
      ),
454
    ),
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
      ),
465
    ),
466
  );
467
  $form['at-settings']['tablet']['portrait']['tablet-portrait-sidebar-width-wrapper']['tablet-portrait-sidebar-message-wrapper']['message'] = array(
468
    '#markup' => '<div class="description">' . t('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'),
503
    ),
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'),
529
    ),
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)),
549
    ),
550
  );
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
  );
601

    
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
}