1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Generate form elments for the CSS settings.
|
6
|
*/
|
7
|
function at_core_css_form(&$form, $theme_name) {
|
8
|
// Set variable for mode, we want to show a message based on this
|
9
|
$mode = variable_get('preprocess_css', '') == 1 ? TRUE : FALSE;
|
10
|
$performance_settings_path = url('admin/config/development/performance');
|
11
|
|
12
|
// Global Settings
|
13
|
$form['at-settings']['css-settings'] = array(
|
14
|
'#type' => 'fieldset',
|
15
|
'#title' => t('CSS'),
|
16
|
'#description' => t('<h3>CSS Settings</h3><p>Here you can get feedback on what mode your site is currently using, and enable the optional <code>responsive.custom.css</code> file.</p>'),
|
17
|
);
|
18
|
|
19
|
// Set message depending on the mode
|
20
|
if ($mode == TRUE) {
|
21
|
$mode_message = t('<p><strong><a href="!settings_path" target="_blank">CSS aggregation</a> is ON</strong>. Changes to your themes responsive CSS files will not show until you <strong>re-save the theme settings</strong> (click "Save configuration" at the bottom of this form) and clear the <a href="!settings_path" target="_blank">sites cache</a>.</p><div class="description"><p>This is required to re-write the production version of the responsive styles and is a performance optimization in Adaptivetheme, which saves your site at least 4 HTTP requests.</p></div>', array('!settings_path' => $performance_settings_path));
|
22
|
}
|
23
|
elseif ($mode == FALSE) {
|
24
|
$mode_message = t('<p><strong><a href="!settings_path" target="_blank">CSS aggregation</a> is OFF</strong>. Changes to your themes responsive CSS files will show automatically.</p><p><div class="description"><p>Note: when CSS aggregation is ON you need to re-save the theme settings if you make any changes to your themes responsive stylesheets. This is required to re-write the production version of the responsive styles and is a performance optimization in Adaptivetheme, which saves your site at least 4 HTTP requests.</p></div>', array('!settings_path' => $performance_settings_path));
|
25
|
}
|
26
|
|
27
|
// Mode
|
28
|
$form['at-settings']['css-settings']['mode'] = array(
|
29
|
'#type' => 'fieldset',
|
30
|
'#title' => t('CSS Mode'),
|
31
|
'#description' => t('<h3>Mode</h3>') . $mode_message,
|
32
|
'#states' => array(
|
33
|
'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
|
34
|
),
|
35
|
);
|
36
|
|
37
|
// Custom media queries
|
38
|
$form['at-settings']['css-settings']['custom-mediaqueries'] = array(
|
39
|
'#type' => 'fieldset',
|
40
|
'#title' => t('Custom Media Queries'),
|
41
|
'#description' => t('<h3>Custom Media Queries</h3>'),
|
42
|
'#states' => array(
|
43
|
'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
|
44
|
),
|
45
|
);
|
46
|
$form['at-settings']['css-settings']['custom-mediaqueries']['enable_custom_media_queries'] = array(
|
47
|
'#type' => 'checkbox',
|
48
|
'#title' => t('Enable the responsive.custom.css file'),
|
49
|
'#description' => t('<p>Use this file if you need to use custom media queries, such as <a href="!zomigi" target="_blank">overlapped media queries</a>.</p><p><strong>File location:</strong> <code>@theme_path/css/responsive.custom.css</code>, .scss version: <code>@theme_path/sass/responsive.custom.scss</code></p>', array('!zomigi' => 'http://zomigi.com/blog/essential-considerations-for-crafting-quality-media-queries/#mq-overlap-stack', '@theme_path' => $theme_name)),
|
50
|
'#default_value' => at_get_setting('enable_custom_media_queries'),
|
51
|
);
|
52
|
}
|