1
|
<?php
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11
|
|
12
|
|
13
|
|
14
|
|
15
|
|
16
|
function adminimal_form_system_theme_settings_alter(&$form, &$form_state) {
|
17
|
|
18
|
|
19
|
global $base_url;
|
20
|
$adminimal_path = drupal_get_path('theme', 'adminimal');
|
21
|
$old_css_path = $adminimal_path . '/css/custom.css';
|
22
|
$custom_css_path = 'public://adminimal-custom.css';
|
23
|
$custom_css_dir = str_replace($base_url . '/', "", file_create_url($custom_css_path));
|
24
|
$custom_css_url = file_create_url($custom_css_path);
|
25
|
|
26
|
|
27
|
if (!file_exists($custom_css_path)) {
|
28
|
|
29
|
|
30
|
if (file_exists($old_css_path)) {
|
31
|
file_unmanaged_copy($old_css_path, $custom_css_path, FILE_EXISTS_ERROR);
|
32
|
}
|
33
|
|
34
|
else {
|
35
|
file_unmanaged_save_data("", $custom_css_path, FILE_EXISTS_ERROR);
|
36
|
}
|
37
|
|
38
|
}
|
39
|
|
40
|
|
41
|
if (file_exists($old_css_path)) {
|
42
|
drupal_set_message(t('Please delete the old @css_location file, as its no longer used.', array('@css_location file' => $old_css_path)), 'warning');
|
43
|
}
|
44
|
|
45
|
$form['adminimal_custom'] = array(
|
46
|
'#type' => 'fieldset',
|
47
|
'#title' => t('Adminimal Customization'),
|
48
|
'#weight' => -10,
|
49
|
);
|
50
|
|
51
|
$form['skin'] = array(
|
52
|
'#type' => 'fieldset',
|
53
|
'#title' => t('Adminimal skin'),
|
54
|
'#weight' => -11,
|
55
|
);
|
56
|
|
57
|
|
58
|
$form['skin']['adminimal_theme_skin'] = array(
|
59
|
'#type' => 'select',
|
60
|
'#title' => t('Skin selection'),
|
61
|
'#default_value' => theme_get_setting('adminimal_theme_skin'),
|
62
|
'#options' => array(
|
63
|
'default' => t('Adminimal Default'),
|
64
|
|
65
|
|
66
|
'material' => t('Material (BETA version)'),
|
67
|
'alternative' => t('Alternative'),
|
68
|
),
|
69
|
'#description' => t('Select desired skin style. Note that this feature is in beta stage and there might be some issues.'),
|
70
|
'#required' => FALSE,
|
71
|
);
|
72
|
|
73
|
$form['adminimal_custom']['style_checkboxes'] = array(
|
74
|
'#type' => 'checkbox',
|
75
|
'#title' => t('Style checkboxes and radio buttons in Webkit browsers.'),
|
76
|
'#description' => t('Enabling this option will style checkbox and radio buttons for Webkit browsers like Google Chrome, Safari, Opera and their mobile versions.
|
77
|
Enabling this option will <strong>not</strong> have any negative impact on older browsers that dont support pure CSS styling of checkboxes like Internet Explorer or Firefox.'),
|
78
|
'#default_value' => theme_get_setting('style_checkboxes'),
|
79
|
);
|
80
|
|
81
|
$form['adminimal_custom']['display_icons_config'] = array(
|
82
|
'#type' => 'checkbox',
|
83
|
'#title' => t('Display icons in Configuration page'),
|
84
|
'#default_value' => theme_get_setting('display_icons_config'),
|
85
|
);
|
86
|
|
87
|
$form['adminimal_custom']['rounded_buttons'] = array(
|
88
|
'#type' => 'checkbox',
|
89
|
'#title' => t('Use rounded buttons'),
|
90
|
'#description' => t('Uncheck this setting if you dont like the rounded button styling for some action links'),
|
91
|
'#default_value' => theme_get_setting('rounded_buttons'),
|
92
|
);
|
93
|
|
94
|
$form['adminimal_custom']['sticky_actions'] = array(
|
95
|
'#type' => 'checkbox',
|
96
|
'#title' => t('Sticky form actions'),
|
97
|
'#description' => t('This will make the form actions div fixed bottom positioning. So for example when you visit the node edit page you wont need to scroll down to save/preview/delete the node. The form action buttons will be sticky to the bottom of the screen.'),
|
98
|
'#default_value' => theme_get_setting('sticky_actions'),
|
99
|
);
|
100
|
|
101
|
$form['adminimal_custom']['avoid_custom_font'] = array(
|
102
|
'#type' => 'checkbox',
|
103
|
'#title' => t('Avoid using "Open Sans" font'),
|
104
|
'#description' => t('(useful for languages that are not well supported by the "Open sans" font. Like Japanese for example)'),
|
105
|
'#default_value' => theme_get_setting('avoid_custom_font'),
|
106
|
);
|
107
|
|
108
|
$form['adminimal_custom']['adminimal_ckeditor'] = array(
|
109
|
'#type' => 'checkbox',
|
110
|
'#title' => t('CKEditor support'),
|
111
|
'#description' => t('Loads custom adminimal css skin for CKEditor. Disable this to avoid css conflicts when using other CKEditor skins.'),
|
112
|
'#default_value' => theme_get_setting('adminimal_ckeditor'),
|
113
|
);
|
114
|
|
115
|
$form['adminimal_custom']['use_custom_media_queries'] = array(
|
116
|
'#type' => 'checkbox',
|
117
|
'#title' => t('Use Custom Media Queries'),
|
118
|
'#description' => t('You can override the mobile and tablet media queries from this option. Use it only if you know what media queries are and how to use them.'),
|
119
|
'#default_value' => theme_get_setting('use_custom_media_queries'),
|
120
|
);
|
121
|
|
122
|
$form['adminimal_custom']['media_queries'] = array(
|
123
|
'#type' => 'fieldset',
|
124
|
'#title' => t('Custom Media Queries'),
|
125
|
'#states' => array(
|
126
|
|
127
|
'visible' => array(
|
128
|
':input[name="use_custom_media_queries"]' => array('checked' => TRUE),
|
129
|
),
|
130
|
),
|
131
|
);
|
132
|
|
133
|
$form['adminimal_custom']['media_queries']['media_query_mobile'] = array(
|
134
|
'#type' => 'textfield',
|
135
|
'#title' => t('Mobile media query'),
|
136
|
'#description' => t('The media query to load the mobile.css styles.'),
|
137
|
'#default_value' => theme_get_setting('media_query_mobile'),
|
138
|
);
|
139
|
|
140
|
$form['adminimal_custom']['media_queries']['media_query_tablet'] = array(
|
141
|
'#type' => 'textfield',
|
142
|
'#title' => t('Tablet media query'),
|
143
|
'#description' => t('The media query to load the tablet.css styles.'),
|
144
|
'#default_value' => theme_get_setting('media_query_tablet'),
|
145
|
);
|
146
|
|
147
|
$form['adminimal_custom']['custom_css'] = array(
|
148
|
'#type' => 'checkbox',
|
149
|
'#title' => t('Use "adminimal-custom.css"'),
|
150
|
'#description' => t('Include adminimal-custom.css file to override or add custom css code without subthememing/hacking Adminimal Theme.'),
|
151
|
'#default_value' => theme_get_setting('custom_css'),
|
152
|
);
|
153
|
|
154
|
$form['adminimal_custom']['adminimal_custom_check'] = array(
|
155
|
'#type' => 'fieldset',
|
156
|
'#title' => t('Custom CSS file check'),
|
157
|
'#weight' => 50,
|
158
|
'#states' => array(
|
159
|
|
160
|
'visible' => array(
|
161
|
':input[name="custom_css"]' => array('checked' => TRUE),
|
162
|
),
|
163
|
),
|
164
|
);
|
165
|
|
166
|
if (file_exists($custom_css_path)) {
|
167
|
$form['adminimal_custom']['adminimal_custom_check']['custom_css_description'] = array(
|
168
|
'#markup' => t('Custom CSS file Found in: !css', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")),
|
169
|
'#prefix' => '<div class="messages status custom_css_found">',
|
170
|
'#suffix' => '</div>',
|
171
|
);
|
172
|
}
|
173
|
else {
|
174
|
$form['adminimal_custom']['adminimal_custom_check']['custom_css_not_found'] = array(
|
175
|
'#markup' => t('Custom CSS file not found. You must create the !css file manually.', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")),
|
176
|
'#prefix' => '<div class="messages error custom_css_not_found">',
|
177
|
'#suffix' => '</div>',
|
178
|
);
|
179
|
}
|
180
|
}
|