1 |
85ad3d82
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Generate form elments for the Polyfills settings.
|
6 |
|
|
*
|
7 |
|
|
* TODO: review documentation and provide links to help pages.
|
8 |
|
|
*/
|
9 |
74f6bef0
|
Assos Assos
|
function at_core_polyfills_form(&$form, $theme_name) {
|
10 |
|
|
$form['at-settings']['polyfills'] = array(
|
11 |
|
|
'#type' => 'fieldset',
|
12 |
|
|
'#title' => t('Polyfills'),
|
13 |
|
|
'#description' => t('<h3>Polyfills</h3><p>Here you can enable commonly used Polyfills supplied with the core theme. Adaptivetheme also supports loading <a href="!docspage" target="_blank">scripts and CSS for Internet Explorer</a> using your sub-themes info file.', array('!docspage' => 'http://adaptivethemes.com/documentation/ie-styles-and-scripts')),
|
14 |
|
|
);
|
15 |
85ad3d82
|
Assos Assos
|
|
16 |
74f6bef0
|
Assos Assos
|
$form['at-settings']['polyfills']['fills'] = array(
|
17 |
|
|
'#type' => 'fieldset',
|
18 |
|
|
'#title' => t('Polyfills'),
|
19 |
|
|
);
|
20 |
85ad3d82
|
Assos Assos
|
|
21 |
74f6bef0
|
Assos Assos
|
// HTML5 shiv
|
22 |
|
|
$form['at-settings']['polyfills']['fills']['load_html5js'] = array(
|
23 |
|
|
'#type' => 'checkbox',
|
24 |
|
|
'#title' => t('HTML5 support in IE'),
|
25 |
|
|
'#description' => t('By checking this setting the site will load the <a href="!html5shiv_link" target="_blank">html5shiv</a>. Turning this off will be bad news for IE6-8.', array('!html5shiv_link' => '//github.com/aFarkas/html5shiv')),
|
26 |
|
|
'#default_value' => at_get_setting('load_html5js'),
|
27 |
|
|
);
|
28 |
85ad3d82
|
Assos Assos
|
|
29 |
74f6bef0
|
Assos Assos
|
// matchMedia polyfill: https://github.com/paulirish/matchMedia.js
|
30 |
|
|
$form['at-settings']['polyfills']['fills']['load_matchmediajs'] = array(
|
31 |
|
|
'#type' => 'checkbox',
|
32 |
|
|
'#title' => t('matchMedia.js Polyfill'),
|
33 |
|
|
'#description' => t('Backport matchMedia support to unsupporting browsers - see <a href="!matchmedia_link" target="_blank">github.com/paulirish/matchMedia</a>. If using the Menu Toggle extension you need this if supporting Android 2.3 or earlier is important. Do not enable this if you are using respond.js (see <em>Media query support for IE6-8</em>, below) or Modernizr. A number of other libraries load this polyfill also - it\'s worth checking, although its also a very small polyfill.', array('!matchmedia_link' => '//github.com/paulirish/matchMedia.js')),
|
34 |
|
|
'#default_value' => at_get_setting('load_matchmediajs'),
|
35 |
|
|
);
|
36 |
85ad3d82
|
Assos Assos
|
|
37 |
74f6bef0
|
Assos Assos
|
// OnMediaQuery.js
|
38 |
|
|
$script_filepath = '/' . $theme_name . '/scripts/media_queries.js';
|
39 |
|
|
$form['at-settings']['polyfills']['fills']['load_onmediaqueryjs'] = array(
|
40 |
|
|
'#type' => 'checkbox',
|
41 |
|
|
'#title' => t('Responsive JavaScript <sup>(deprecated)</sup>'),
|
42 |
|
|
'#description' => t('This is deprecated because AT Core now loads it\'s media queries into Drupals JS settings - see <code>menu-toggle.js</code> in the core theme for an example of how this can be used with matchMedia. This legacy feature loads the <a href="!onmediaquery_link" target="_blank">JS Media Queries</a> plugin to enable responsive JavaScript. See <code>@script_filepath</code> for instructions on how to use. This is an alternative to using matchMedia.', array('!onmediaquery_link' => '//github.com/JoshBarr/js-media-queries', '@script_filepath' => $script_filepath)),
|
43 |
|
|
'#default_value' => at_get_setting('load_onmediaqueryjs'),
|
44 |
|
|
);
|
45 |
85ad3d82
|
Assos Assos
|
|
46 |
74f6bef0
|
Assos Assos
|
// Rounding error fix (CSS)
|
47 |
|
|
$form['at-settings']['polyfills']['fills']['load_ltie8css'] = array(
|
48 |
|
|
'#type' => 'checkbox',
|
49 |
|
|
'#title' => t('Fix CSS rounding errors in IE6-7'),
|
50 |
|
|
'#description' => t('Load a stylesheet that fixes percentage rounding errors in IE6-7. You need this if you are using Gpanels or Panels layouts.'),
|
51 |
|
|
'#default_value' => at_get_setting('load_ltie8css'),
|
52 |
|
|
);
|
53 |
85ad3d82
|
Assos Assos
|
|
54 |
74f6bef0
|
Assos Assos
|
// Respond.js
|
55 |
|
|
$form['at-settings']['polyfills']['fills']['load_respondjs'] = array(
|
56 |
|
|
'#type' => 'checkbox',
|
57 |
|
|
'#title' => t('Media query support for IE6-8 (respond.js)'),
|
58 |
|
|
'#description' => t('By checking this setting IE6, 7 and 8 will rely on <a href="!respondjs_link" target="_blank">respond.js</a> to set the layout.', array('!respondjs_link' => '//github.com/scottjehl/Respond')),
|
59 |
|
|
'#default_value' => at_get_setting('load_respondjs'),
|
60 |
|
|
'#states' => array(
|
61 |
|
|
'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
|
62 |
|
|
),
|
63 |
|
|
);
|
64 |
85ad3d82
|
Assos Assos
|
|
65 |
74f6bef0
|
Assos Assos
|
// Scalefix
|
66 |
|
|
$form['at-settings']['polyfills']['fills']['load_scalefixjs'] = array(
|
67 |
|
|
'#type' => 'checkbox',
|
68 |
|
|
'#title' => t('Scalefix for iOS'),
|
69 |
|
|
'#description' => t('Fixes the iOS Orientationchange zoom bug. See <a href="!scalefix_link" target="_blank">github.com/scottjehl/iOS-Orientationchange-Fix</a>.', array('!scalefix_link' => 'https://github.com/scottjehl/iOS-Orientationchange-Fix')),
|
70 |
|
|
'#default_value' => at_get_setting('load_scalefixjs'),
|
71 |
|
|
'#states' => array(
|
72 |
|
|
'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
|
73 |
|
|
),
|
74 |
|
|
);
|
75 |
|
|
} |