/[drupal]/contributions/themes/flexible/theme-settings.php
ViewVC logotype

Contents of /contributions/themes/flexible/theme-settings.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Tue Oct 21 17:11:45 2008 UTC (13 months ago) by stevelockwood
Branch: MAIN
CVS Tags: DRUPAL-6--1-6, HEAD
Changes since 1.2: +17 -3 lines
File MIME type: text/x-php
DRUPAL-6--1-6:
--------------
Bug in additional stylesheets fixed
Body classes include a reference to the node so you can define node-specific css
Bug in content links (incorrect html) fixed
"No promoted content" setting added so you can have a default front page but without the default Drupal welcome message
Block ID should now display properly - if that option is selected
1 <?php
2
3 function phptemplate_settings($saved_settings) {
4 // additional variables for this theme - the order in which elements appear
5 $defaults = array(
6 'accessibility_modes'=>'Page:Normal:Normal
7 Page:Normal:@styles/page_normal.png
8 Page:Plain:Plain layout without fancy styles
9 Page:Plain:@styles/page_plain.png
10 Page:Plain:-sites/all/themes/flexible/flexible2.css
11 Page:Plain:+styles/page_plain.css
12
13 Font:Normal:Normal
14 Font:Normal:@styles/font_normal.png
15 Font:Large:Large fonts
16 Font:Large:@styles/font_large.png
17 Font:Large:+styles/font_large.css
18 Font:VeryLarge:Very large fonts
19 Font:VeryLarge:@styles/font_verylarge.png
20 Font:VeryLarge:-sites/all/themes/flexible/flexible2.css
21 Font:VeryLarge:+styles/page_plain.css
22 Font:VeryLarge:+styles/font_verylarge.css
23
24 Colour:Normal:Normal
25 Colour:Normal:@styles/colour_normal.png
26 Colour:Restful:Restful colour scheme
27 Colour:Restful:@styles/colour_restful.png
28 Colour:Restful:-sites/all/themes/flexible/flexible2_box.css
29 Colour:Restful:+styles/colour_restful.css
30 Colour:HighContrast:Light text on a dark background
31 Colour:HighContrast:@styles/colour_highcontrast.png
32 Colour:HighContrast:-sites/all/themes/flexible/flexible2_box.css
33 Colour:HighContrast:+styles/colour_highcontrast.css
34 ',
35 'accessibility_modelocation'=>'accessibility',
36 'css_header_outer'=>null,
37 'css_header_accessibility'=>null,
38 'css_header_top'=>null,
39 'css_header_inner'=>'box_shadow',
40 'css_logo'=>null,
41 'css_title'=>null,
42 'css_slogan'=>null,
43 'css_header_bottom'=>null,
44 'css_content_outer'=>null,
45 'css_left'=>'box_shadow',
46 'css_centre'=>'box_shadow',
47 'css_content_top'=>null,
48 'css_content_inner'=>null,
49 'css_mission'=>null,
50 'css_breadcrumb'=>null,
51 'css_title'=>null,
52 'css_messages'=>null,
53 'css_tabs'=>null,
54 'css_help'=>null,
55 'css_content'=>null,
56 'css_contentbottom'=>null,
57 'css_right'=>'box_shadow',
58 'css_footer_outer'=>'box_shadow',
59 'css_footer_top'=>null,
60 'css_footer_message'=>null,
61 'css_footer_bottom'=>null,
62 'no_promoted_content'=>false,
63 );
64
65 // Merge the saved variables and their default values
66 $settings = array_merge($defaults, $saved_settings);
67
68 // list of weight options
69 $weights = array();
70 for ($i = -10; $i < 11; $i++) {
71 $weights[$i] = $i;
72 }
73
74 // Create the form widgets using Forms API
75 $form['accessibility'] = array(
76 '#type' => 'fieldset',
77 '#title' => t('Accessibility features'),
78 '#description' => t('Allows you to set additional accessibility features')
79 );
80 $form['accessibility']['accessibility_guide_url'] = array(
81 '#type' => 'textfield',
82 '#title' => t('URL of accessibility guide'),
83 '#default_value' => $settings['accessibility_guide_url'],
84 );
85 $form['accessibility']['accessibility_modes'] = array(
86 '#type' => 'textarea',
87 '#title' => t('Rules to control accessibility modes'),
88 '#default_value' => $settings['accessibility_modes'],
89 '#description'=>'Accessibility modes let individual users control aspects of how the website is displayed by switching on or off particular stylesheets. The default modes are: Site, Font and Colour. Each mode then has a number of options, for example, the options for Font are Large and Very Large. Each option can switch on additional CSS styles sheets (or it can switch off existing style sheets). There should be one rule per line and each rule can be one of the following three types:<pre>Mode:Option:Description {provides a description of the option}<br />Mode:Option:@image {specifies the image that will be displayed to represent this option}<br />Mode:Option:+Stylesheet {applies the given stylesheet if the option is turned on}<br />Mode:Option:-Stylesheet {disables an existing stylesheet if the option is turned on}</pre>Note: When adding a stylesheet the file/path is relative to the theme directory - when removing a stylesheet the full path (without the initial /) must be given, eg:<pre>Page:Plain:-sites/all/themes/flexible2/flexible2.css {disable the main theme stylesheet}<br />Page:Plain:+styles/page_plain.css {add a stylesheet which is in a subdirectory of the theme}</pre>',
90 );
91 $form['accessibility']['accessibility_modelocation'] = array(
92 '#type' => 'select',
93 '#title' => t('Where to put the accessibility mode selector'),
94 '#description' => t('The accessibility modes are displayed as a set of "icons" - You can decide where to put these icons using this selector. Note, if you put your icons in the left or right sidebars, you will need to put some other content into those areas to make sure they are displayed properly.'),
95 '#default_value' => $settings['accessibility_modelocation'],
96 '#options' => array(
97 'accessibility'=>'accessibility',
98 'left'=>'left',
99 'centre'=>'centre',
100 'right'=>'right',
101 'footer'=>'footer'
102 )
103 );
104 $form['css'] = array(
105 '#type' => 'fieldset',
106 '#title' => t('CSS classes'),
107 '#description' => t("Allows you to set CSS class(es) for specific regions. Pre-set classes which apply rounded boxes are documented in the <a href=\"/@path\" target=\"_blank\">boxes.htm</a> file which accompanies this theme. The readme.txt file, which accompanies this theme, contains additional instructions for creating your own box styles.", array('@path'=>path_to_theme().'/boxes.htm')).' '.t('The regions are laid out in the following format:') .
108 '<div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: grey; color: white;">body_outer
109 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; color: white; background-color: blue;">header_outer
110 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">accessibility</div>
111 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">header_top</div>
112 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">header_inner
113 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; color: white; background-color: blue;">logo</div>
114 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; color: white; background-color: blue;">title</div>
115 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; color: white; background-color: blue;">slogan</div>
116 </div>
117 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">header_bottom</div>
118 </div>
119 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; color: white; background-color: blue;">content_outer
120 <div style="float: left; width: 15%; height: 15em; margin-right: 10px; padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">left</div>
121 <div style="float: left; width: 50%; height: 15em; margin-right: 10px; padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">centre
122 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; color: white; background-color: blue;">content_top</div>
123 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; color: white; background-color: blue;">content_inner
124 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">mission</div>
125 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">breadcrumb</div>
126 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">title</div>
127 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">messages</div>
128 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">tabs</div>
129 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">help</div>
130 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">content</div>
131 </div>
132 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; color: white; background-color: blue;">content_bottom</div>
133 </div>
134 <div style="float: left; width: 15%; height: 15em; padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">right</div>
135 <div style="clear: both"></div>
136 </div>
137 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; color: white; background-color: blue;">footer_outer
138 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">footer_top</div>
139 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">footer_message</div>
140 <div style="padding-left: 10px; padding-right: 10px; padding-bottom: 1px; background-color: white; color: blue;">footer_bottom</div>
141 </div>
142 </div>'
143
144 );
145 $form['css']['css_body_outer'] = array(
146 '#type' => 'textfield',
147 '#title' => t('CSS class(es) for body_outer section'),
148 '#default_value' => $settings['css_body_outer'],
149 );
150 $form['css']['css_header_outer'] = array(
151 '#type' => 'textfield',
152 '#title' => t('CSS class(es) for header_outer section'),
153 '#default_value' => $settings['css_header_outer'],
154 );
155 $form['css']['css_accessibility'] = array(
156 '#type' => 'textfield',
157 '#title' => t('CSS class(es) for accessibility section'),
158 '#default_value' => $settings['css_accessibility'],
159 );
160 $form['css']['css_header_top'] = array(
161 '#type' => 'textfield',
162 '#title' => t('CSS class(es) for header_top section'),
163 '#default_value' => $settings['css_header_top'],
164 );
165 $form['css']['css_header_inner'] = array(
166 '#type' => 'textfield',
167 '#title' => t('CSS class(es) for header_inner section'),
168 '#default_value' => $settings['css_header_inner'],
169 );
170 $form['css']['css_logo'] = array(
171 '#type' => 'textfield',
172 '#title' => t('CSS class(es) for logo section'),
173 '#default_value' => $settings['css_logo'],
174 );
175 $form['css']['css_site_name'] = array(
176 '#type' => 'textfield',
177 '#title' => t('CSS class(es) for site_name section'),
178 '#default_value' => $settings['css_site_name'],
179 );
180 $form['css']['css_site_slogan'] = array(
181 '#type' => 'textfield',
182 '#title' => t('CSS class(es) for site_slogan section'),
183 '#default_value' => $settings['css_site_slogan'],
184 );
185 $form['css']['css_header_bottom'] = array(
186 '#type' => 'textfield',
187 '#title' => t('CSS class(es) for header_bottom section'),
188 '#default_value' => $settings['css_header_bottom'],
189 );
190 $form['css']['css_content_outer'] = array(
191 '#type' => 'textfield',
192 '#title' => t('CSS class(es) for content_outer section'),
193 '#default_value' => $settings['css_content_outer'],
194 );
195 $form['css']['css_left'] = array(
196 '#type' => 'textfield',
197 '#title' => t('CSS class(es) for left section'),
198 '#default_value' => $settings['css_left'],
199 );
200 $form['css']['css_centre'] = array(
201 '#type' => 'textfield',
202 '#title' => t('CSS class(es) for centre section'),
203 '#default_value' => $settings['css_centre'],
204 );
205 $form['css']['css_content_top'] = array(
206 '#type' => 'textfield',
207 '#title' => t('CSS class(es) for content_top section'),
208 '#default_value' => $settings['css_content_top'],
209 );
210 $form['css']['css_content_inner'] = array(
211 '#type' => 'textfield',
212 '#title' => t('CSS class(es) for content_inner section'),
213 '#default_value' => $settings['css_content_inner'],
214 );
215 $form['css']['css_mission'] = array(
216 '#type' => 'textfield',
217 '#title' => t('CSS class(es) for mission section'),
218 '#default_value' => $settings['css_mission'],
219 );
220 $form['css']['css_breadcrumb'] = array(
221 '#type' => 'textfield',
222 '#title' => t('CSS class(es) for breadcrumb section'),
223 '#default_value' => $settings['css_breadcrumb'],
224 );
225 $form['css']['css_title'] = array(
226 '#type' => 'textfield',
227 '#title' => t('CSS class(es) for title section'),
228 '#default_value' => $settings['css_title'],
229 );
230 $form['css']['css_messages'] = array(
231 '#type' => 'textfield',
232 '#title' => t('CSS class(es) for messages section'),
233 '#default_value' => $settings['css_messages'],
234 );
235 $form['css']['css_tabs'] = array(
236 '#type' => 'textfield',
237 '#title' => t('CSS class(es) for tabs section'),
238 '#default_value' => $settings['css_tabs'],
239 );
240 $form['css']['css_help'] = array(
241 '#type' => 'textfield',
242 '#title' => t('CSS class(es) for help section'),
243 '#default_value' => $settings['css_help'],
244 );
245 $form['css']['css_content'] = array(
246 '#type' => 'textfield',
247 '#title' => t('CSS class(es) for content section'),
248 '#default_value' => $settings['css_content'],
249 );
250 $form['css']['css_content_bottom'] = array(
251 '#type' => 'textfield',
252 '#title' => t('CSS class(es) for content_bottom section'),
253 '#default_value' => $settings['css_content_bottom'],
254 );
255 $form['css']['css_right'] = array(
256 '#type' => 'textfield',
257 '#title' => t('CSS class(es) for right section'),
258 '#default_value' => $settings['css_right'],
259 );
260 $form['css']['css_footer_outer'] = array(
261 '#type' => 'textfield',
262 '#title' => t('CSS class(es) for footer_outer section'),
263 '#default_value' => $settings['css_footer_outer'],
264 );
265 $form['css']['css_footer_top'] = array(
266 '#type' => 'textfield',
267 '#title' => t('CSS class(es) for footer_top section'),
268 '#default_value' => $settings['css_footer_top'],
269 );
270 $form['css']['css_footer_message'] = array(
271 '#type' => 'textfield',
272 '#title' => t('CSS class(es) for footer_message section'),
273 '#default_value' => $settings['css_footer_message'],
274 );
275 $form['css']['css_footer_bottom'] = array(
276 '#type' => 'textfield',
277 '#title' => t('CSS class(es) for footer_bottom section'),
278 '#default_value' => $settings['css_footer_bottom'],
279 );
280 $form['css']['blocks'] = array(
281 '#value' => t('You can also apply CSS classes to specific blocks delivered from Drupal core. Blocks are usually identified by a module name and a delta value - for instance the Navigation links come from the "user" module and the delta is "1", i.e. "user-1"; Primary links are identified as "menu-primary-links". etc.'),
282 );
283 $form['css']['block_id'] = array(
284 '#type' => 'checkbox',
285 '#title' => t('Identify Drupal blocks'),
286 '#default_value' => $settings['block_id'],
287 '#description' => t('Turn this feature on to help you identify the Drupal block id during the development of your site - don\'t forget to turn it off for production sites!')
288 );
289 $form['css']['block_rules'] = array(
290 '#type' => 'textarea',
291 '#title' => t('CSS rules for blocks'),
292 '#default_value' => $settings['block_rules'],
293 '#description' => t('Enter the rules for applying CSS classes to specific blocks here. Each rule should be on a separate line and should be of the form: module-delta: classes. For example, if you want the navigation block to have a CSS class of MyClass, you should enter:<pre>user-1:MyClass</pre> or, to put a shadow box around the primary links block<pre>menu-primary-links: box_shadow</pre>')
294 );
295 $form['css']['info'] = array(
296 '#value'=> t('<strong>Body classes and Page-specific classes:</strong><br />The theme will put the Drupal standard body classes on the body element - these give you the opportunity to tailor the CSS according to the type of page. In addition, the theme will also tell you the actual page, eg if the page is ?q=node/192 the body will have a class of page_node_192 (ie page_ followed by the path of the page where / is changed to _). This will let you have specific CSS rules for specific pages.')
297 );
298 $form['css']['css_rules'] = array(
299 '#type' => 'textarea',
300 '#title' => t('Additional inline CSS'),
301 '#default_value' => $settings['css_rules'],
302 '#description' => t('This section lets you type CSS rules which will be inserted, as an inline style, into every page. This isn\'t the most efficient way to deliver CSS to the browser (it isn\'t cached) so it is suggested that you only use it for prototyping or very small "tweaks". One you have worked out the CSS you need you should put it into custom.css or one of the additional css stylesheets, which you can specify in the next section.')
303 );
304 $form['css']['css_sheets'] = array(
305 '#type' => 'textarea',
306 '#title' => t('Additional CSS sheets'),
307 '#default_value' => $settings['css_sheets'],
308 '#description' => t('If you want your own stylesheets you can list them here. Put each stylesheet name on a separate line. The system will look for the stylesheet in the same directory as the Flexible 2 theme - if you put the stylesheet in a subdirectory, you will need to specify that as well eg<pre>MySubdirectory/MySheet.css</pre> Note, you might also want to switch off these style sheets if a user selects one of the accessibility modes. So, if you added mystyles.css in the theme directory, you can disable it whenever High Contrast mode is selected by adding the following line to the "Rules to control accessibility modes:" section: <pre>Colour:HighContrast:-sites/all/themes/flexible/mystyles.css</pre> ')
309 );
310 $form['css']['validators'] = array(
311 '#type' => 'checkbox',
312 '#title' => t('Show links to validators'),
313 '#default_value' => $settings['validators'],
314 '#description' => t('Turn this feature on to display links to the W3C validators - you will probably only want to enable this feature during development.')
315 );
316 $form['other'] = array(
317 '#type' => 'fieldset',
318 '#title' => t('Other settings'),
319 );
320 $form['other']['no_promoted_content'] = array(
321 '#type' => 'checkbox',
322 '#title' => t('No promoted front page content'),
323 '#default_value' => $settings['no_promoted_content'],
324 '#description' => t('If you check this setting, Drupal will not put its default content on the front page, ie "node". If you don\'t have any promoted nodes, this setting will prevent the "Welcome to Drupal" message being displayed. If you do have promoted nodes, they will not be displayed.')
325 );
326
327 // Return the additional form widgets
328 return $form;
329 }

  ViewVC Help
Powered by ViewVC 1.1.2