1 |
87dbc3bf
|
Benjamin Luce
|
<?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 |
e4c061ad
|
Assos Assos
|
global $base_url;
|
20 |
87dbc3bf
|
Benjamin Luce
|
$adminimal_path = drupal_get_path('theme', 'adminimal');
|
21 |
e4c061ad
|
Assos Assos
|
$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 |
87dbc3bf
|
Benjamin Luce
|
|
45 |
|
|
$form['adminimal_custom'] = array(
|
46 |
|
|
'#type' => 'fieldset',
|
47 |
|
|
'#title' => t('Adminimal Customization'),
|
48 |
|
|
'#weight' => -10,
|
49 |
|
|
);
|
50 |
|
|
|
51 |
c6d34680
|
Assos Assos
|
$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 |
0a17cb7f
|
Assos Assos
|
'dark' => t('Adminimal Dark (BETA)'),
|
65 |
c6d34680
|
Assos Assos
|
|
66 |
0a17cb7f
|
Assos Assos
|
'material' => t('Material (BETA)'),
|
67 |
3b63f8c7
|
Assos Assos
|
'alternative' => t('Alternative'),
|
68 |
c6d34680
|
Assos Assos
|
),
|
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 |
0a17cb7f
|
Assos Assos
|
$form['adminimal_custom']['use_bootstrap_grids'] = array(
|
74 |
|
|
'#type' => 'checkbox',
|
75 |
|
|
'#title' => t('Use Bootstrap Grids'),
|
76 |
|
|
'#default_value' => theme_get_setting('use_bootstrap_grids'),
|
77 |
|
|
);
|
78 |
|
|
|
79 |
c6d34680
|
Assos Assos
|
$form['adminimal_custom']['style_checkboxes'] = array(
|
80 |
|
|
'#type' => 'checkbox',
|
81 |
|
|
'#title' => t('Style checkboxes and radio buttons in Webkit browsers.'),
|
82 |
|
|
'#description' => t('Enabling this option will style checkbox and radio buttons for Webkit browsers like Google Chrome, Safari, Opera and their mobile versions.
|
83 |
|
|
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.'),
|
84 |
|
|
'#default_value' => theme_get_setting('style_checkboxes'),
|
85 |
|
|
);
|
86 |
|
|
|
87 |
87dbc3bf
|
Benjamin Luce
|
$form['adminimal_custom']['display_icons_config'] = array(
|
88 |
|
|
'#type' => 'checkbox',
|
89 |
|
|
'#title' => t('Display icons in Configuration page'),
|
90 |
|
|
'#default_value' => theme_get_setting('display_icons_config'),
|
91 |
|
|
);
|
92 |
|
|
|
93 |
3b63f8c7
|
Assos Assos
|
$form['adminimal_custom']['rounded_buttons'] = array(
|
94 |
|
|
'#type' => 'checkbox',
|
95 |
|
|
'#title' => t('Use rounded buttons'),
|
96 |
|
|
'#description' => t('Uncheck this setting if you dont like the rounded button styling for some action links'),
|
97 |
|
|
'#default_value' => theme_get_setting('rounded_buttons'),
|
98 |
|
|
);
|
99 |
|
|
|
100 |
|
|
$form['adminimal_custom']['sticky_actions'] = array(
|
101 |
|
|
'#type' => 'checkbox',
|
102 |
|
|
'#title' => t('Sticky form actions'),
|
103 |
|
|
'#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.'),
|
104 |
|
|
'#default_value' => theme_get_setting('sticky_actions'),
|
105 |
|
|
);
|
106 |
|
|
|
107 |
c6d34680
|
Assos Assos
|
$form['adminimal_custom']['avoid_custom_font'] = array(
|
108 |
|
|
'#type' => 'checkbox',
|
109 |
|
|
'#title' => t('Avoid using "Open Sans" font'),
|
110 |
|
|
'#description' => t('(useful for languages that are not well supported by the "Open sans" font. Like Japanese for example)'),
|
111 |
|
|
'#default_value' => theme_get_setting('avoid_custom_font'),
|
112 |
|
|
);
|
113 |
|
|
|
114 |
a192dc0b
|
Assos Assos
|
$form['adminimal_custom']['adminimal_ckeditor'] = array(
|
115 |
|
|
'#type' => 'checkbox',
|
116 |
|
|
'#title' => t('CKEditor support'),
|
117 |
|
|
'#description' => t('Loads custom adminimal css skin for CKEditor. Disable this to avoid css conflicts when using other CKEditor skins.'),
|
118 |
|
|
'#default_value' => theme_get_setting('adminimal_ckeditor'),
|
119 |
|
|
);
|
120 |
|
|
|
121 |
87dbc3bf
|
Benjamin Luce
|
$form['adminimal_custom']['use_custom_media_queries'] = array(
|
122 |
|
|
'#type' => 'checkbox',
|
123 |
|
|
'#title' => t('Use Custom Media Queries'),
|
124 |
|
|
'#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.'),
|
125 |
|
|
'#default_value' => theme_get_setting('use_custom_media_queries'),
|
126 |
|
|
);
|
127 |
|
|
|
128 |
|
|
$form['adminimal_custom']['media_queries'] = array(
|
129 |
|
|
'#type' => 'fieldset',
|
130 |
|
|
'#title' => t('Custom Media Queries'),
|
131 |
|
|
'#states' => array(
|
132 |
|
|
|
133 |
|
|
'visible' => array(
|
134 |
|
|
':input[name="use_custom_media_queries"]' => array('checked' => TRUE),
|
135 |
|
|
),
|
136 |
|
|
),
|
137 |
|
|
);
|
138 |
|
|
|
139 |
|
|
$form['adminimal_custom']['media_queries']['media_query_mobile'] = array(
|
140 |
|
|
'#type' => 'textfield',
|
141 |
|
|
'#title' => t('Mobile media query'),
|
142 |
|
|
'#description' => t('The media query to load the mobile.css styles.'),
|
143 |
|
|
'#default_value' => theme_get_setting('media_query_mobile'),
|
144 |
|
|
);
|
145 |
|
|
|
146 |
|
|
$form['adminimal_custom']['media_queries']['media_query_tablet'] = array(
|
147 |
|
|
'#type' => 'textfield',
|
148 |
|
|
'#title' => t('Tablet media query'),
|
149 |
|
|
'#description' => t('The media query to load the tablet.css styles.'),
|
150 |
|
|
'#default_value' => theme_get_setting('media_query_tablet'),
|
151 |
|
|
);
|
152 |
|
|
|
153 |
|
|
$form['adminimal_custom']['custom_css'] = array(
|
154 |
|
|
'#type' => 'checkbox',
|
155 |
e4c061ad
|
Assos Assos
|
'#title' => t('Use "adminimal-custom.css"'),
|
156 |
|
|
'#description' => t('Include adminimal-custom.css file to override or add custom css code without subthememing/hacking Adminimal Theme.'),
|
157 |
87dbc3bf
|
Benjamin Luce
|
'#default_value' => theme_get_setting('custom_css'),
|
158 |
|
|
);
|
159 |
|
|
|
160 |
|
|
$form['adminimal_custom']['adminimal_custom_check'] = array(
|
161 |
|
|
'#type' => 'fieldset',
|
162 |
|
|
'#title' => t('Custom CSS file check'),
|
163 |
|
|
'#weight' => 50,
|
164 |
|
|
'#states' => array(
|
165 |
|
|
|
166 |
|
|
'visible' => array(
|
167 |
|
|
':input[name="custom_css"]' => array('checked' => TRUE),
|
168 |
|
|
),
|
169 |
|
|
),
|
170 |
|
|
);
|
171 |
|
|
|
172 |
|
|
if (file_exists($custom_css_path)) {
|
173 |
|
|
$form['adminimal_custom']['adminimal_custom_check']['custom_css_description'] = array(
|
174 |
e4c061ad
|
Assos Assos
|
'#markup' => t('Custom CSS file Found in: !css', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")),
|
175 |
87dbc3bf
|
Benjamin Luce
|
'#prefix' => '<div class="messages status custom_css_found">',
|
176 |
|
|
'#suffix' => '</div>',
|
177 |
|
|
);
|
178 |
|
|
}
|
179 |
|
|
else {
|
180 |
|
|
$form['adminimal_custom']['adminimal_custom_check']['custom_css_not_found'] = array(
|
181 |
e4c061ad
|
Assos Assos
|
'#markup' => t('Custom CSS file not found. You must create the !css file manually.', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")),
|
182 |
87dbc3bf
|
Benjamin Luce
|
'#prefix' => '<div class="messages error custom_css_not_found">',
|
183 |
|
|
'#suffix' => '</div>',
|
184 |
|
|
);
|
185 |
|
|
}
|
186 |
|
|
} |