4 * Provides the settings for the Nitobe theme.
7 require_once
drupal_get_path("theme", "nitobe") .
"/nitobe.utils.inc";
10 * Exposes Nitobe's theme settings.
13 * Nested array of form elements that comprise the form.
14 * @param array &$form_state
15 * A keyed array containing the current state of the form. The arguments that
16 * drupal_get_form() was originally called with are available in the array
17 * $form_state['build_info']['args'].
19 function nitobe_form_system_theme_settings_alter(&$form, &$form_state) {
20 $form["nitobe_general_settings"] = array(
21 "#type" => "fieldset",
22 "#title" => "General Nitobe settings",
25 // -- What ordering should be used for the content and sidebars?
26 $default = theme_get_setting("nitobe_content_placement", "nitobe");
27 $desc = t("Where should the sidebars be placed?");
29 "center" => "On either side of the content region.",
30 "right" => "Right of the content region.",
31 "left" => "Left of the content region.",
34 $form["nitobe_general_settings"]['nitobe_content_placement'] = array(
36 "#title" => t("Sidebar placement"),
37 "#options" => $options,
38 "#default_value" => $default,
39 "#description" => $desc,
42 // -- How many page items to put in the pager widgets.
43 $default = theme_get_setting("nitobe_pager_page_count", "nitobe");
44 $options = range(3, 10);
45 $desc = t("The number of default pages to include in pager controls. If you are using a three column layout, a lower number here will work better.");
47 $form["nitobe_general_settings"]['nitobe_pager_page_count'] = array(
49 "#title" => t('Pager item count'),
50 "#options" => drupal_map_assoc($options),
51 "#default_value" => $default,
52 "#description" => $desc,
55 _nitobe_add_header_settings($form);
56 _nitobe_add_time_format_settings($form);
61 * Adds the date/time format settings to the settings form.
64 * Nested array of form elements that comprise the form.
66 function _nitobe_add_time_format_settings(&$form) {
68 "attributes" => array("target" => "_blank"),
74 "!link" => l(t("date()"), "http://php.net/manual/en/function.date.php",
78 $desc = t("These settings are used to control how dates are rendered on nodes and comments. Refer to the documentation for PHP's !link function for details on date formats.",
80 $form["nitobe_datetime_settings"] = array(
81 "#type" => "fieldset",
82 "#title" => "Date and time formats",
83 "#description" => $desc,
86 // -- The node timestamp format
87 $default = theme_get_setting("nitobe_node_datestamp_format", "nitobe");
88 $desc = t("This controls how dates are rendered in a node's header.");
89 $form["nitobe_datetime_settings"]["nitobe_node_datestamp_format"] = array(
90 "#type" => "textfield",
91 "#title" => t("Node date format"),
94 "#description" => $desc,
95 "#default_value" => $default,
98 // -- The comment attribution date format
99 $default = theme_get_setting("nitobe_comment_date_format", "nitobe");
100 $desc = t("This controls how a comment's date is rendered in the author attribution text.");
101 $form["nitobe_datetime_settings"]["nitobe_comment_date_format"] = array(
102 "#type" => "textfield",
103 "#title" => t("Comment date format"),
106 "#description" => $desc,
107 "#default_value" => $default,
110 // -- The comment attribution time format
111 $default = theme_get_setting("nitobe_comment_time_format", "nitobe");
112 $desc = t("This controls how a comment's time is rendered in the author attribution text.");
113 $form["nitobe_datetime_settings"]["nitobe_comment_time_format"] = array(
114 "#type" => "textfield",
115 "#title" => t("Comment date format"),
118 "#description" => $desc,
119 "#default_value" => $default,
125 * Adds the header settings to the settings form.
128 * The form element array to add the settings fields to.
130 function _nitobe_add_header_settings(&$form) {
131 $form["nitobe_header_settings"] = array(
132 "#type" => "fieldset",
133 "#title" => "Page header settings",
136 // -- Should the alternating color title effect be applied?
137 $default = theme_get_setting("nitobe_title_effect", "nitobe");
138 $desc = t("Should the title be adjusted to apply an alternate color to every other word and remove inter-word spacing?");
139 $form["nitobe_header_settings"]["nitobe_title_effect"] = array(
140 "#type" => "checkbox",
141 "#title" => t("Apply title effect"),
142 "#default_value" => $default,
143 "#description" => $desc,
146 // -- Get the header image list.
147 $images = _nitobe_get_header_list(TRUE
);
148 $options = array("<random>" => "<Random Header Image>");
150 foreach ($images as
$filename => $data) {
151 $options[$filename] = $data->pretty_name
;
154 // -- The setting for the header image.
155 $current = theme_get_setting("nitobe_header_image", "nitobe");
156 $default = in_array($current, array_keys($options)) ?
$current : "<random>";
157 $form["nitobe_header_settings"]["nitobe_header_image"] = array(
159 "#title" => t("Header image"),
160 "#options" => $options,
161 "#default_value" => $default,
164 // -- Show the header image if the mastead region has content?
165 $default = theme_get_setting("nitobe_masthead_always_show", "nitobe");
166 $desc = t("By default, if there is block content in the Masthead region, the header image will not be displayed. Check this box to cause the header image to be displayed as the region's background image.");
167 $form["nitobe_header_settings"]["nitobe_masthead_always_show"] = array(
168 "#type" => "checkbox",
169 "#title" => t("Always show masthead image"),
170 "#default_value" => $default,
171 "#description" => $desc,