Add region.tpl.php template
[project/zen.git] / theme-settings.php
CommitLineData
52521ba9
J
1<?php
2// $Id$
3
7acc50a0 4// Include the definition of zen_theme_get_default_settings().
007fb748 5include_once './' . drupal_get_path('theme', 'zen') . '/zen-internals/template.theme-registry.inc';
7acc50a0
J
6
7
52521ba9
J
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 */
18function zen_settings($saved_settings, $subtheme_defaults = array()) {
19
47d4fcdc 20 // Add the form's CSS
007fb748 21 drupal_add_css(drupal_get_path('theme', 'zen') . '/zen-internals/css/theme-settings.css', 'theme');
47d4fcdc 22
52521ba9 23 // Add javascript to show/hide optional settings
007fb748 24 drupal_add_js(drupal_get_path('theme', 'zen') . '/zen-internals/js/theme-settings.js', 'theme');
52521ba9 25
7b846edf 26 // Get the default values from the .info file.
7acc50a0 27 $defaults = zen_theme_get_default_settings('zen');
7b846edf
J
28
29 // Allow a subtheme to override the default values.
52521ba9
J
30 $defaults = array_merge($defaults, $subtheme_defaults);
31
7b846edf 32 // Merge the saved variables and their default values.
52521ba9
J
33 $settings = array_merge($defaults, $saved_settings);
34
35 /*
7b846edf 36 * Create the form using Forms API
52521ba9 37 */
47d4fcdc
J
38 $form['zen-div-opening'] = array(
39 '#value' => '<div id="zen-settings">',
40 );
41
28511ba8
J
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
52521ba9
J
49 $form['breadcrumb'] = array(
50 '#type' => 'fieldset',
51 '#title' => t('Breadcrumb settings'),
47d4fcdc 52 '#attributes' => array('id' => 'zen-breadcrumb'),
52521ba9
J
53 );
54 $form['breadcrumb']['zen_breadcrumb'] = array(
55 '#type' => 'select',
56 '#title' => t('Display breadcrumb'),
57 '#default_value' => $settings['zen_breadcrumb'],
58 '#options' => array(
47d4fcdc
J
59 'yes' => t('Yes'),
60 'admin' => t('Only in admin section'),
61 'no' => t('No'),
52521ba9
J
62 ),
63 );
64 $form['breadcrumb']['zen_breadcrumb_separator'] = array(
65 '#type' => 'textfield',
66 '#title' => t('Breadcrumb separator'),
47d4fcdc 67 '#description' => t('Text only. Don’t forget to include spaces.'),
52521ba9
J
68 '#default_value' => $settings['zen_breadcrumb_separator'],
69 '#size' => 5,
70 '#maxlength' => 10,
47d4fcdc 71 '#prefix' => '<div id="div-zen-breadcrumb-collapse">', // jquery hook to show/hide optional widgets
52521ba9
J
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'],
47d4fcdc 82 '#description' => t('Useful when the breadcrumb is placed just before the title.'),
47a99cfa
J
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.'),
52521ba9
J
89 '#suffix' => '</div>', // #div-zen-breadcrumb
90 );
91
47d4fcdc
J
92 $form['themedev'] = array(
93 '#type' => 'fieldset',
94 '#title' => t('Theme development settings'),
95 '#attributes' => array('id' => 'zen-themedev'),
96 );
89804871
J
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 );
47d4fcdc
J
105 $form['themedev']['zen_layout'] = array(
106 '#type' => 'radios',
107 '#title' => t('Layout method'),
108 '#options' => array(
28cea6b1
J
109 'zen-columns-liquid' => t('Liquid layout') . ' <small>(layout-liquid.css)</small>',
110 'zen-columns-fixed' => t('Fixed layout') . ' <small>(layout-fixed.css)</small>',
47d4fcdc
J
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'],
89804871 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')),
adc5ab38 119 '#prefix' => '<div id="div-zen-wireframes"><strong>' . t('Wireframes:') . '</strong>',
47d4fcdc
J
120 '#suffix' => '</div>',
121 );
122
123 $form['zen-div-closing'] = array(
124 '#value' => '</div>',
125 );
126
52521ba9
J
127 // Return the form
128 return $form;
129}