Fixes some PAReview issues.
[project/rijkshuisstijl.git] / theme-settings.php
1 <?php
2 /**
3 * @file
4 * Functionality for the admin form of the theme.
5 */
6
7 $path_rijkshuisstijl = drupal_get_path('theme', 'rijkshuisstijl');
8 include_once './' . $path_rijkshuisstijl . '/functions/misc.php';
9
10 /**
11 * Implements hook_form_system_theme_settings_alter().
12 */
13 function rijkshuisstijl_form_system_theme_settings_alter(&$form, $form_state) {
14 // Add some stylesheets for the theme settings.
15 drupal_add_css(drupal_get_path('theme', 'rijkshuisstijl') . '/styles/theme-settings.css', array(
16 'group' => CSS_THEME,
17 'weight' => 115,
18 'preprocess' => FALSE,
19 ));
20
21 // Disable some required display toggles.
22 $form['theme_settings']['toggle_logo']['#disabled'] = TRUE;
23
24 // Override the logo path form element with our own logo form element.
25 $form['logo']['settings']['logo_path'] = array(
26 '#type' => 'select',
27 '#title' => t('Custom logo'),
28 '#options' => _rijkshuisstijl_defined_logos(),
29 '#default_value' => theme_get_setting('logo_path'),
30 '#description' => t('Select a custom logo for a specific government agency.'),
31 );
32 // Remove the logo upload form from the display.
33 $form['logo']['settings']['logo_upload']['#access'] = FALSE;
34
35 $form['titlebar'] = array(
36 '#type' => 'fieldset',
37 '#title' => t('Titlebar settings'),
38 '#weight' => -20,
39 );
40
41 $form['titlebar']['default_titlebar'] = array(
42 '#type' => 'checkbox',
43 '#title' => t('Use the default site title and slogan in the titlebar.'),
44 '#default_value' => theme_get_setting('default_titlebar', 'rijkshuisstijl'),
45 '#collapsible' => TRUE,
46 '#collapsed' => FALSE,
47 );
48
49 $form['titlebar']['settings'] = array(
50 '#type' => 'container',
51 '#states' => array(
52 // Hide the titlebar settings when using the default logo.
53 'invisible' => array(
54 'input[name="default_titlebar"]' => array('checked' => TRUE),
55 ),
56 ),
57 );
58
59 $form['titlebar']['settings']['titlebar_title'] = array(
60 '#type' => 'textfield',
61 '#title' => t('Custom titlebar title'),
62 '#default_value' => theme_get_setting('titlebar_title', 'rijkshuisstijl'),
63 '#size' => 60,
64 '#maxlength' => 128,
65 '#description' => t("Override the titlebar's title with a custom title."),
66 );
67
68 $form['titlebar']['settings']['titlebar_slogan'] = array(
69 '#type' => 'textfield',
70 '#title' => t('Custom titlebar slogan'),
71 '#default_value' => theme_get_setting('titlebar_slogan', 'rijkshuisstijl'),
72 '#size' => 60,
73 '#maxlength' => 128,
74 '#description' => t("Override the titlebar's slogan with a custom slogan."),
75 );
76
77 $form['color'] = array(
78 '#type' => 'fieldset',
79 '#title' => t('Color settings'),
80 '#collapsible' => TRUE,
81 '#collapsed' => FALSE,
82 '#weight' => -19,
83 );
84
85 $colours = _rijkshuisstijl_defined_colours();
86 $colours_assoc = array();
87 foreach (_rijkshuisstijl_defined_colours() as $index => $colour) {
88 $colours_assoc[$colour] = _rijkshuisstijl_format_color_swatch($colour);
89 }
90
91 $form['color']['color_swatch'] = array(
92 '#type' => 'radios',
93 '#title' => t('Color swatches'),
94 '#options' => $colours_assoc,
95 '#default_value' => theme_get_setting('color_swatch', 'rijkshuisstijl'),
96 );
97
98 $form['system'] = array(
99 '#type' => 'fieldset',
100 '#title' => t('System settings'),
101 '#collapsible' => TRUE,
102 '#collapsed' => FALSE,
103 '#weight' => -18,
104 );
105
106 $form['system']['system_type'] = array(
107 '#type' => 'radios',
108 '#title' => t('Type'),
109 '#default_value' => theme_get_setting('system_type', 'rijkshuisstijl'),
110 '#options' => array(
111 // @todo This should be defined somewhere else.
112 'internet' => 'Internet',
113 'intranet' => 'Intranet / External Application',
114 'application' => 'Internal Application',
115 ),
116 // @todo Should the colors be influenced?
117 '#description' => t('The choice of %system influenced the layout, the available colors and other theme settings.', array(
118 '%system' => 'system',
119 )),
120 );
121
122 $form['internet_settings'] = array(
123 '#type' => 'fieldset',
124 '#title' => t('Internet Settings'),
125 '#collapsible' => TRUE,
126 '#collapsed' => FALSE,
127 '#states' => array(
128 'visible' => array(
129 ':input[name="system_type"]' => array('value' => 'internet'),
130 ),
131 ),
132 '#weight' => -17,
133 );
134
135 $form['internet_settings']['system_width'] = array(
136 '#type' => 'radios',
137 '#title' => t('Width And Column Behaviour'),
138 '#default_value' => theme_get_setting('system_width'),
139 '#options' => drupal_map_assoc(array('default', 'wide', 'wider', 'liquid')),
140 '#description' => t('Select the behaviour for the sizing of columns.'),
141 );
142 }