#1069106 by JohnAlbin: Update theme-settings.php to use Form API states
[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 */
fb2d48c9 10function zen_form_system_theme_settings_alter(&$form, $form_state) {
52521ba9 11 /*
7b846edf 12 * Create the form using Forms API
52521ba9
J
13 */
14 $form['breadcrumb'] = array(
15 '#type' => 'fieldset',
16 '#title' => t('Breadcrumb settings'),
17 );
18 $form['breadcrumb']['zen_breadcrumb'] = array(
19 '#type' => 'select',
20 '#title' => t('Display breadcrumb'),
fb2d48c9 21 '#default_value' => theme_get_setting('zen_breadcrumb'),
52521ba9 22 '#options' => array(
47d4fcdc
J
23 'yes' => t('Yes'),
24 'admin' => t('Only in admin section'),
25 'no' => t('No'),
52521ba9
J
26 ),
27 );
b47e92ba
J
28 $form['breadcrumb']['breadcrumb_options'] = array(
29 '#type' => 'container',
30 '#states' => array(
31 'invisible' => array(
32 ':input[name="zen_breadcrumb"]' => array('value' => 'no'),
33 ),
34 ),
35 );
36 $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_separator'] = array(
52521ba9
J
37 '#type' => 'textfield',
38 '#title' => t('Breadcrumb separator'),
47d4fcdc 39 '#description' => t('Text only. Don’t forget to include spaces.'),
fb2d48c9 40 '#default_value' => theme_get_setting('zen_breadcrumb_separator'),
52521ba9
J
41 '#size' => 5,
42 '#maxlength' => 10,
52521ba9 43 );
b47e92ba 44 $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_home'] = array(
52521ba9
J
45 '#type' => 'checkbox',
46 '#title' => t('Show home page link in breadcrumb'),
fb2d48c9 47 '#default_value' => theme_get_setting('zen_breadcrumb_home'),
52521ba9 48 );
b47e92ba 49 $form['breadcrumb']['breadcrumb_options']['zen_breadcrumb_trailing'] = array(
52521ba9
J
50 '#type' => 'checkbox',
51 '#title' => t('Append a separator to the end of the breadcrumb'),
fb2d48c9 52 '#default_value' => theme_get_setting('zen_breadcrumb_trailing'),
47d4fcdc 53 '#description' => t('Useful when the breadcrumb is placed just before the title.'),
b47e92ba
J
54 '#states' => array(
55 'disabled' => array(
56 ':input[name="zen_breadcrumb_title"]' => array('checked' => TRUE),
57 ),
58 'unchecked' => array(
59 ':input[name="zen_breadcrumb_title"]' => array('checked' => TRUE),
60 ),
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
47d4fcdc
J
70 $form['themedev'] = array(
71 '#type' => 'fieldset',
72 '#title' => t('Theme development settings'),
47d4fcdc 73 );
89804871
J
74 $form['themedev']['zen_rebuild_registry'] = array(
75 '#type' => 'checkbox',
76 '#title' => t('Rebuild theme registry on every page.'),
fb2d48c9 77 '#default_value' => theme_get_setting('zen_rebuild_registry'),
89804871 78 '#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' => 'http://drupal.org/node/173880#theme-registry')),
89804871 79 );
47d4fcdc
J
80 $form['themedev']['zen_layout'] = array(
81 '#type' => 'radios',
82 '#title' => t('Layout method'),
83 '#options' => array(
28cea6b1
J
84 'zen-columns-liquid' => t('Liquid layout') . ' <small>(layout-liquid.css)</small>',
85 'zen-columns-fixed' => t('Fixed layout') . ' <small>(layout-fixed.css)</small>',
47d4fcdc 86 ),
fb2d48c9 87 '#default_value' => theme_get_setting('zen_layout'),
47d4fcdc
J
88 );
89 $form['themedev']['zen_wireframes'] = array(
90 '#type' => 'checkbox',
b47e92ba 91 '#title' => t('Add wireframes around main layout elements'),
fb2d48c9 92 '#default_value' => theme_get_setting('zen_wireframes'),
89804871 93 '#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 94 );
52521ba9 95}