Projet

Général

Profil

Paste
Télécharger (6,39 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / themes / zen / theme-settings.php @ ba09eb79

1
<?php
2
/**
3
 * Implements hook_form_system_theme_settings_alter() function.
4
 *
5
 * @param $form
6
 *   Nested array of form elements that comprise the form.
7
 * @param $form_state
8
 *   A keyed array containing the current state of the form.
9
 */
10
function zen_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL) {
11
  // Work-around for a core bug affecting admin themes. See issue #943212.
12
  if (isset($form_id)) {
13
    return;
14
  }
15

    
16
  // Create the form using Forms API
17
  $form['breadcrumb'] = array(
18
    '#type'          => 'fieldset',
19
    '#title'         => t('Breadcrumb settings'),
20
  );
21
  $form['breadcrumb']['zen_breadcrumb'] = array(
22
    '#type'          => 'select',
23
    '#title'         => t('Display breadcrumb'),
24
    '#default_value' => theme_get_setting('zen_breadcrumb'),
25
    '#options'       => array(
26
                          'yes'   => t('Yes'),
27
                          'admin' => t('Only in admin section'),
28
                          'no'    => t('No'),
29
                        ),
30
  );
31
  $form['breadcrumb']['breadcrumb_options'] = array(
32
    '#type' => 'container',
33
    '#states' => array(
34
      'invisible' => array(
35
        ':input[name="zen_breadcrumb"]' => array('value' => 'no'),
36
      ),
37
    ),
38
  );
39
  $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_separator'] = array(
40
    '#type'          => 'textfield',
41
    '#title'         => t('Breadcrumb separator'),
42
    '#description'   => t('Text only. Don’t forget to include spaces.'),
43
    '#default_value' => theme_get_setting('zen_breadcrumb_separator'),
44
    '#size'          => 5,
45
    '#maxlength'     => 10,
46
  );
47
  $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_home'] = array(
48
    '#type'          => 'checkbox',
49
    '#title'         => t('Show home page link in breadcrumb'),
50
    '#default_value' => theme_get_setting('zen_breadcrumb_home'),
51
  );
52
  $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_trailing'] = array(
53
    '#type'          => 'checkbox',
54
    '#title'         => t('Append a separator to the end of the breadcrumb'),
55
    '#default_value' => theme_get_setting('zen_breadcrumb_trailing'),
56
    '#description'   => t('Useful when the breadcrumb is placed just before the title.'),
57
    '#states' => array(
58
      'disabled' => array(
59
        ':input[name="zen_breadcrumb_title"]' => array('checked' => TRUE),
60
      ),
61
    ),
62
  );
63
  $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_title'] = array(
64
    '#type'          => 'checkbox',
65
    '#title'         => t('Append the content title to the end of the breadcrumb'),
66
    '#default_value' => theme_get_setting('zen_breadcrumb_title'),
67
    '#description'   => t('Useful when the breadcrumb is not placed just before the title.'),
68
  );
69

    
70
  $form['support'] = array(
71
    '#type'          => 'fieldset',
72
    '#title'         => t('Accessibility and support settings'),
73
  );
74
  // Only toggle the layout for the main Zen theme.
75
  if ($form['var']['#value'] == 'theme_zen_settings') {
76
    $form['support']['zen_layout'] = array(
77
      '#type'          => 'radios',
78
      '#title'         => t('Layout'),
79
      '#options'       => array(
80
        'zen-responsive-sidebars' => t('Responsive sidebar layout') . ' <small>(layouts/responsive-sidebars.css)</small>',
81
        'zen-fixed-width' => t('Fixed width layout') . ' <small>(layouts/fixed-width.css)</small>',
82
      ),
83
      '#default_value' => theme_get_setting('zen_layout'),
84
    );
85
  }
86
  $form['support']['zen_skip_link_anchor'] = array(
87
    '#type'          => 'textfield',
88
    '#title'         => t('Anchor ID for the “skip link”'),
89
    '#default_value' => theme_get_setting('zen_skip_link_anchor'),
90
    '#field_prefix'  => '#',
91
    '#description'   => t('Specify the HTML ID of the element that the accessible-but-hidden “skip link” should link to. Note: that element should have the <code>tabindex="-1"</code> attribute to prevent an accessibility bug in webkit browsers. (<a href="!link">Read more about skip links</a>.)', array('!link' => 'https://drupal.org/node/467976')),
92
  );
93
  $form['support']['zen_skip_link_text'] = array(
94
    '#type'          => 'textfield',
95
    '#title'         => t('Text for the “skip link”'),
96
    '#default_value' => theme_get_setting('zen_skip_link_text'),
97
    '#description'   => t('For example: <em>Jump to navigation</em>, <em>Skip to content</em>'),
98
  );
99
  $form['support']['zen_html5_respond_meta'] = array(
100
    '#type'          => 'checkboxes',
101
    '#title'         => t('Add HTML5 and responsive scripts and meta tags to every page.'),
102
    '#default_value' => theme_get_setting('zen_html5_respond_meta'),
103
    '#options'       => array(
104
                          'respond' => t('Add Respond.js JavaScript to add basic CSS3 media query support to IE 6-8.'),
105
                          'html5' => t('Add HTML5 shim JavaScript to add support to IE 6-8.'),
106
                          'meta' => t('Add meta tags to support responsive design on mobile devices.'),
107
                        ),
108
    '#description'   => t('IE 6-8 require a JavaScript polyfill solution to add basic support of HTML5 and CSS3 media queries. If you prefer to use another polyfill solution, such as <a href="!link">Modernizr</a>, you can disable these options. Respond.js only works if <a href="@url">Aggregate CSS</a> is enabled. Mobile devices require a few meta tags for responsive designs.', array('!link' => 'http://www.modernizr.com/', '@url' => url('admin/config/development/performance'))),
109
  );
110

    
111
  $form['themedev'] = array(
112
    '#type'          => 'fieldset',
113
    '#title'         => t('Theme development settings'),
114
  );
115
  $form['themedev']['zen_rebuild_registry'] = array(
116
    '#type'          => 'checkbox',
117
    '#title'         => t('Rebuild theme registry on every page.'),
118
    '#default_value' => theme_get_setting('zen_rebuild_registry'),
119
    '#description'   => t('During theme development, it can be very useful to continuously <a href="!link">rebuild the theme registry</a>. WARNING: this is a huge performance penalty and must be turned off on production websites.', array('!link' => 'https://drupal.org/node/173880#theme-registry')),
120
  );
121
  $form['themedev']['zen_wireframes'] = array(
122
    '#type'          => 'checkbox',
123
    '#title'         => t('Add wireframes around main layout elements'),
124
    '#default_value' => theme_get_setting('zen_wireframes'),
125
    '#description'   => t('<a href="!link">Wireframes</a> are useful when prototyping a website.', array('!link' => 'http://www.boxesandarrows.com/view/html_wireframes_and_prototypes_all_gain_and_no_pain')),
126
  );
127
}