Révision f8e16685
Ajouté par Assos Assos il y a presque 5 ans
drupal7/sites/all/themes/adminimal_theme/theme-settings.php | ||
---|---|---|
19 | 19 |
global $base_url; |
20 | 20 |
$adminimal_path = drupal_get_path('theme', 'adminimal'); |
21 | 21 |
$old_css_path = $adminimal_path . '/css/custom.css'; |
22 |
$custom_css_path = 'public://adminimal-custom.css'; |
|
22 |
$custom_css_path = theme_get_setting('custom_css_path'); |
|
23 |
if (empty($custom_css_path)) { |
|
24 |
$custom_css_path = 'public://adminimal-custom.css'; |
|
25 |
} |
|
23 | 26 |
$custom_css_dir = str_replace($base_url . '/', "", file_create_url($custom_css_path)); |
24 | 27 |
$custom_css_url = file_create_url($custom_css_path); |
25 | 28 |
|
... | ... | |
152 | 155 |
|
153 | 156 |
$form['adminimal_custom']['custom_css'] = array( |
154 | 157 |
'#type' => 'checkbox', |
155 |
'#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.'),
|
|
158 |
'#title' => t('Extend Adminimal with Custom CSS.'),
|
|
159 |
'#description' => t('Include custom css file to override or add custom css code without subthememing/hacking Adminimal Theme.'),
|
|
157 | 160 |
'#default_value' => theme_get_setting('custom_css'), |
158 | 161 |
); |
159 | 162 |
|
160 |
$form['adminimal_custom']['adminimal_custom_check'] = array(
|
|
163 |
$form['adminimal_custom']['adminimal_custom'] = array( |
|
161 | 164 |
'#type' => 'fieldset', |
162 |
'#title' => t('Custom CSS file check'), |
|
165 |
'#title' => t('Custom CSS file'), |
|
166 |
'#description' => t('The file will be created, if not found, after saving.'), |
|
163 | 167 |
'#weight' => 50, |
164 | 168 |
'#states' => array( |
165 |
// Hide the settings when the cancel notify checkbox is disabled.
|
|
169 |
// Hide the settings when the custom css checkbox is disabled.
|
|
166 | 170 |
'visible' => array( |
167 |
':input[name="custom_css"]' => array('checked' => TRUE), |
|
171 |
':input[name="custom_css"]' => array('checked' => TRUE),
|
|
168 | 172 |
), |
169 |
),
|
|
173 |
), |
|
170 | 174 |
); |
171 | 175 |
|
172 | 176 |
if (file_exists($custom_css_path)) { |
173 |
$form['adminimal_custom']['adminimal_custom_check']['custom_css_description'] = array(
|
|
174 |
'#markup' => t('Custom CSS file Found in: !css', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")),
|
|
177 |
$form['adminimal_custom']['adminimal_custom']['custom_css_description'] = array( |
|
178 |
'#markup' => t('Custom CSS file found in: !css', array('!css' => '<span class="css_path">' . $custom_css_dir . '</span>')),
|
|
175 | 179 |
'#prefix' => '<div class="messages status custom_css_found">', |
176 | 180 |
'#suffix' => '</div>', |
177 | 181 |
); |
178 | 182 |
} |
179 | 183 |
else { |
180 |
$form['adminimal_custom']['adminimal_custom_check']['custom_css_not_found'] = array(
|
|
181 |
'#markup' => t('Custom CSS file not found. You must create the !css file manually.', array('!css' => "<span class='css_path'>" . $custom_css_dir . "</span>")),
|
|
184 |
$form['adminimal_custom']['adminimal_custom']['custom_css_not_found'] = array( |
|
185 |
'#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 | 186 |
'#prefix' => '<div class="messages error custom_css_not_found">', |
183 | 187 |
'#suffix' => '</div>', |
184 | 188 |
); |
185 | 189 |
} |
190 |
|
|
191 |
$form['adminimal_custom']['adminimal_custom']['custom_css_path'] = array( |
|
192 |
'#type' => 'textfield', |
|
193 |
'#title' => t('Custom CSS path'), |
|
194 |
'#description' => t('<b>Leave blank to use the default path (public://adminimal-custom.css)</b>. Can be a filepath of URI'), |
|
195 |
'#default_value' => theme_get_setting('custom_css_path'), |
|
196 |
); |
|
186 | 197 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules