Updated comments on page.tpl.php.
[project/zen.git] / theme-settings.php
1 <?php
2 // $Id$
3
4 // Include the definition of zen_theme_get_default_settings().
5 include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.theme-registry.inc';
6
7
8 /**
9 * Implementation of THEMEHOOK_settings() function.
10 *
11 * @param $saved_settings
12 * An array of saved settings for this theme.
13 * @param $subtheme_defaults
14 * Allow a subtheme to override the default values.
15 * @return
16 * A form array.
17 */
18 function zen_settings($saved_settings, $subtheme_defaults = array()) {
19
20 // Add the form's CSS
21 drupal_add_css(drupal_get_path('theme', 'zen') . '/zen-internals/css/theme-settings.css', 'theme');
22
23 // Add javascript to show/hide optional settings
24 drupal_add_js(drupal_get_path('theme', 'zen') . '/zen-internals/js/theme-settings.js', 'theme');
25
26 // Get the default values from the .info file.
27 $defaults = zen_theme_get_default_settings('zen');
28
29 // Allow a subtheme to override the default values.
30 $defaults = array_merge($defaults, $subtheme_defaults);
31
32 // Merge the saved variables and their default values.
33 $settings = array_merge($defaults, $saved_settings);
34
35 /*
36 * Create the form using Forms API
37 */
38 $form['zen-div-opening'] = array(
39 '#value' => '<div id="zen-settings">',
40 );
41
42 $form['zen_block_editing'] = array(
43 '#type' => 'checkbox',
44 '#title' => t('Show block editing on hover'),
45 '#description' => t('When hovering over a block, privileged users will see block editing links.'),
46 '#default_value' => $settings['zen_block_editing'],
47 );
48
49 $form['breadcrumb'] = array(
50 '#type' => 'fieldset',
51 '#title' => t('Breadcrumb settings'),
52 '#attributes' => array('id' => 'zen-breadcrumb'),
53 );
54 $form['breadcrumb']['zen_breadcrumb'] = array(
55 '#type' => 'select',
56 '#title' => t('Display breadcrumb'),
57 '#default_value' => $settings['zen_breadcrumb'],
58 '#options' => array(
59 'yes' => t('Yes'),
60 'admin' => t('Only in admin section'),
61 'no' => t('No'),
62 ),
63 );
64 $form['breadcrumb']['zen_breadcrumb_separator'] = array(
65 '#type' => 'textfield',
66 '#title' => t('Breadcrumb separator'),
67 '#description' => t('Text only. Don’t forget to include spaces.'),
68 '#default_value' => $settings['zen_breadcrumb_separator'],
69 '#size' => 5,
70 '#maxlength' => 10,
71 '#prefix' => '<div id="div-zen-breadcrumb-collapse">', // jquery hook to show/hide optional widgets
72 );
73 $form['breadcrumb']['zen_breadcrumb_home'] = array(
74 '#type' => 'checkbox',
75 '#title' => t('Show home page link in breadcrumb'),
76 '#default_value' => $settings['zen_breadcrumb_home'],
77 );
78 $form['breadcrumb']['zen_breadcrumb_trailing'] = array(
79 '#type' => 'checkbox',
80 '#title' => t('Append a separator to the end of the breadcrumb'),
81 '#default_value' => $settings['zen_breadcrumb_trailing'],
82 '#description' => t('Useful when the breadcrumb is placed just before the title.'),
83 );
84 $form['breadcrumb']['zen_breadcrumb_title'] = array(
85 '#type' => 'checkbox',
86 '#title' => t('Append the content title to the end of the breadcrumb'),
87 '#default_value' => $settings['zen_breadcrumb_title'],
88 '#description' => t('Useful when the breadcrumb is not placed just before the title.'),
89 '#suffix' => '</div>', // #div-zen-breadcrumb
90 );
91
92 $form['themedev'] = array(
93 '#type' => 'fieldset',
94 '#title' => t('Theme development settings'),
95 '#attributes' => array('id' => 'zen-themedev'),
96 );
97 $form['themedev']['zen_rebuild_registry'] = array(
98 '#type' => 'checkbox',
99 '#title' => t('Rebuild theme registry on every page.'),
100 '#default_value' => $settings['zen_rebuild_registry'],
101 '#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')),
102 '#prefix' => '<div id="div-zen-registry"><strong>' . t('Theme registry:') . '</strong>',
103 '#suffix' => '</div>',
104 );
105 $form['themedev']['zen_layout'] = array(
106 '#type' => 'radios',
107 '#title' => t('Layout method'),
108 '#options' => array(
109 'zen-columns-liquid' => t('Liquid layout') . ' <small>(layout-liquid.css)</small>',
110 'zen-columns-fixed' => t('Fixed layout') . ' <small>(layout-fixed.css)</small>',
111 ),
112 '#default_value' => $settings['zen_layout'],
113 );
114 $form['themedev']['zen_wireframes'] = array(
115 '#type' => 'checkbox',
116 '#title' => t('Display borders around main layout elements'),
117 '#default_value' => $settings['zen_wireframes'],
118 '#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')),
119 '#prefix' => '<div id="div-zen-wireframes"><strong>' . t('Wireframes:') . '</strong>',
120 '#suffix' => '</div>',
121 );
122
123 $form['zen-div-closing'] = array(
124 '#value' => '</div>',
125 );
126
127 // Return the form
128 return $form;
129 }