Issue #2088687: Change base to init in documentation.
[project/zen.git] / theme-settings.php
CommitLineData
52521ba9 1<?php
52521ba9 2/**
031da3a9 3 * Implements hook_form_system_theme_settings_alter() function.
52521ba9 4 *
fb2d48c9
J
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.
52521ba9 9 */
4e93915b
J
10function 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
52521ba9
J
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'),
fb2d48c9 24 '#default_value' => theme_get_setting('zen_breadcrumb'),
52521ba9 25 '#options' => array(
47d4fcdc
J
26 'yes' => t('Yes'),
27 'admin' => t('Only in admin section'),
28 'no' => t('No'),
52521ba9
J
29 ),
30 );
b47e92ba
J
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(
52521ba9
J
40 '#type' => 'textfield',
41 '#title' => t('Breadcrumb separator'),
47d4fcdc 42 '#description' => t('Text only. Don’t forget to include spaces.'),
fb2d48c9 43 '#default_value' => theme_get_setting('zen_breadcrumb_separator'),
52521ba9
J
44 '#size' => 5,
45 '#maxlength' => 10,
52521ba9 46 );
b47e92ba 47 $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_home'] = array(
52521ba9
J
48 '#type' => 'checkbox',
49 '#title' => t('Show home page link in breadcrumb'),
fb2d48c9 50 '#default_value' => theme_get_setting('zen_breadcrumb_home'),
52521ba9 51 );
b47e92ba 52 $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_trailing'] = array(
52521ba9
J
53 '#type' => 'checkbox',
54 '#title' => t('Append a separator to the end of the breadcrumb'),
fb2d48c9 55 '#default_value' => theme_get_setting('zen_breadcrumb_trailing'),
47d4fcdc 56 '#description' => t('Useful when the breadcrumb is placed just before the title.'),
b47e92ba
J
57 '#states' => array(
58 'disabled' => array(
59 ':input[name="zen_breadcrumb_title"]' => array('checked' => TRUE),
60 ),
b47e92ba 61 ),
47a99cfa 62 );
b47e92ba 63 $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_title'] = array(
47a99cfa
J
64 '#type' => 'checkbox',
65 '#title' => t('Append the content title to the end of the breadcrumb'),
fb2d48c9 66 '#default_value' => theme_get_setting('zen_breadcrumb_title'),
47a99cfa 67 '#description' => t('Useful when the breadcrumb is not placed just before the title.'),
52521ba9
J
68 );
69
3a6e01fa 70 $form['support'] = array(
47d4fcdc 71 '#type' => 'fieldset',
3a6e01fa 72 '#title' => t('Accessibility and support settings'),
89804871 73 );
ca4bbcd4
J
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 }
3a6e01fa 86 $form['support']['zen_skip_link_anchor'] = array(
ffb5438e 87 '#type' => 'textfield',
aeec717d
J
88 '#title' => t('Anchor ID for the “skip link”'),
89 '#default_value' => theme_get_setting('zen_skip_link_anchor'),
ffb5438e 90 '#field_prefix' => '#',
b8ab16e7 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')),
aeec717d 92 );
3a6e01fa 93 $form['support']['zen_skip_link_text'] = array(
aeec717d
J
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>'),
ffb5438e 98 );
3a6e01fa
J
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 ),
d3e4de7c 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'))),
3a6e01fa
J
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'),
b8ab16e7 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')),
3a6e01fa 120 );
47d4fcdc
J
121 $form['themedev']['zen_wireframes'] = array(
122 '#type' => 'checkbox',
b47e92ba 123 '#title' => t('Add wireframes around main layout elements'),
fb2d48c9 124 '#default_value' => theme_get_setting('zen_wireframes'),
89804871 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')),
47d4fcdc 126 );
52521ba9 127}