Projet

Général

Profil

Paste
Télécharger (4,5 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / adaptivetheme / at_core / inc / forms / settings.menutoggle.inc @ 74f6bef0

1
<?php
2

    
3
/**
4
 * @file
5
 * Generate settings for the Menu Toggle form.
6
 */
7
function at_core_menu_toggle_form(&$form) {
8
  $form['at']['menu-toggle'] = array(
9
    '#type' => 'fieldset',
10
    '#title' => t('Mobile Menu Toggle'),
11
    '#weight' => 30,
12
    '#description' => t('<h2>Menu Toggle for Mobile</h2><p>The Menu Toggle will hide selected menus and a single clickable link will appear. Clicking this link toggles the menu open and closed - suitable for mobile devices. Smalltouch/smartphone breakpoints are supported by default.</p><p><strong>Superfish:</strong> if you start using the Superfish module you should re-save the theme settings. Also enable the sf-Touchscreen plugin for your Superfish menu block.</p><p><strong>Polyfills:</strong> for this to work in older browsers (such as IE8 and below) and Android 2 you need to enable the matchMedia polyfill (see the Polyfills tab).</p>'),
13
  );
14

    
15
  // Select additional breakpoints
16
  $form['at']['menu-toggle']['breakpoints'] = array(
17
    '#type' => 'fieldset',
18
    '#title' => t('Breakpoints'),
19
    '#description' => t('<h3>Select Additional Device Breakpoints</h3>'),
20
  );
21

    
22
  $form['at']['menu-toggle']['breakpoints']['menu_toggle_tablet_portrait'] = array(
23
    '#type' => 'checkbox',
24
    '#title' => t('Apply to Tablet Portrait'),
25
    '#default_value' => at_get_setting('menu_toggle_tablet_portrait'),
26
    '#states' => array(
27
      'disabled' => array('input[name=menu_toggle_tablet_landscape]' => array('checked' => TRUE)),
28
    ),
29
  );
30
  $form['at']['menu-toggle']['breakpoints']['menu_toggle_tablet_landscape'] = array(
31
    '#type' => 'checkbox',
32
    '#title' => t('Apply to all Tablet breakpoints'),
33
    '#default_value' => at_get_setting('menu_toggle_tablet_landscape'),
34
  );
35

    
36

    
37
  // Regions and Menus
38
  $form['at']['menu-toggle']['menus-regions'] = array(
39
    '#type' => 'fieldset',
40
    '#title' => t('Menus'),
41
    '#description' => t('<h3>Select Menus and/or Regions</h3>'),
42
  );
43

    
44
  // Core menus
45
  $form['at']['menu-toggle']['menus-regions']['core'] = array(
46
    '#type' => 'fieldset',
47
    '#title' => t('Menus'),
48
    '#description' => t('<strong>Drupal core standard menus (variables printed in page.tpl.php).</strong>'),
49
  );
50
  // Core main menu
51
  $form['at']['menu-toggle']['menus-regions']['core']['menu_toggle_main_menu'] = array(
52
    '#type' => 'checkbox',
53
    '#title' => t('Main Menu'),
54
    '#default_value' => at_get_setting('menu_toggle_main_menu'),
55
  );
56
  // Core secondary menu
57
  $form['at']['menu-toggle']['menus-regions']['core']['menu_toggle_secondary_menu'] = array(
58
    '#type' => 'checkbox',
59
    '#title' => t('Secondary menu'),
60
    '#default_value' => at_get_setting('menu_toggle_secondary_menu'),
61
  );
62

    
63
  // Regions
64
  $form['at']['menu-toggle']['menus-regions']['regions'] = array(
65
    '#type' => 'fieldset',
66
    '#title' => t('Regions'),
67
    '#description' => t('<strong>Regions to apply menu toggles - each menu block in these regions will get a toggle.</strong>'),
68
  );
69

    
70
  // Region - leaderboard
71
  $form['at']['menu-toggle']['menus-regions']['regions']['menu_toggle_leaderboard'] = array(
72
    '#type' => 'checkbox',
73
    '#title' => t('Leaderboard'),
74
    '#default_value' => at_get_setting('menu_toggle_leaderboard'),
75
  );
76
  // Region - header region
77
  $form['at']['menu-toggle']['menus-regions']['regions']['menu_toggle_header'] = array(
78
    '#type' => 'checkbox',
79
    '#title' => t('Header'),
80
    '#default_value' => at_get_setting('menu_toggle_header'),
81
  );
82
  // Region - menu bar
83
  $form['at']['menu-toggle']['menus-regions']['regions']['menu_toggle_menu_bar'] = array(
84
    '#type' => 'checkbox',
85
    '#title' => t('Menu Bar'),
86
    '#default_value' => at_get_setting('menu_toggle_menu_bar'),
87
  );
88

    
89
  // Customize toggle link text
90
  $form['at']['menu-toggle']['titles'] = array(
91
    '#type' => 'fieldset',
92
    '#title' => t('Link Text'),
93
    '#description' => t('<h3>Customize Menu Titles</h3><p>These apply to the Drupal core main and secondary menus (printed in page.tpl.php). If you are using a block in a region you need to change the block title for your menu block (even if it\'s the Main menu block).</p>'),
94
  );
95
  // Main menu title
96
  $form['at']['menu-toggle']['titles']['menu_toggle_main_menu_title'] = array(
97
    '#type' => 'textfield',
98
    '#title' => t('Main menu title'),
99
    '#default_value' => at_get_setting('menu_toggle_main_menu_title'),
100
  );
101
  // Secondary menu title
102
  $form['at']['menu-toggle']['titles']['menu_toggle_secondary_menu_title'] = array(
103
    '#type' => 'textfield',
104
    '#title' => t('Secondary menu title'),
105
    '#default_value' => at_get_setting('menu_toggle_secondary_menu_title'),
106
  );
107
}