at_core.submit.responsive.inc

  1. cis7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/at_core.submit.responsive.inc
  2. cle7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/at_core.submit.responsive.inc
  3. ecd7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/at_core.submit.responsive.inc
  4. elmsmedia7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/at_core.submit.responsive.inc
  5. harmony7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/at_core.submit.responsive.inc
  6. icor7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/at_core.submit.responsive.inc
  7. meedjum_blog7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/at_core.submit.responsive.inc
  8. mooc7 sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/at_core.submit.responsive.inc

Build and save the responsive layouts and styles

This is the main submit handler for building the core layout and processing the responsive stylesheets. The output is five stylesheets saved to public files - the main responsive layout, two conditional stylesheets, the main responsive styles (the aggregated styles with embedded media queries) and a default layout CSS file (for when desktop first method has been selected).

Functions

Namesort descending Description
at_core_submit_reponsive @file Build and save the responsive layouts and styles

File

sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/at_core.submit.responsive.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Build and save the responsive layouts and styles
  5. *
  6. * This is the main submit handler for building the core layout and processing
  7. * the responsive stylesheets. The output is five stylesheets saved to public
  8. * files - the main responsive layout, two conditional stylesheets, the main
  9. * responsive styles (the aggregated styles with embedded media queries) and a
  10. * default layout CSS file (for when desktop first method has been selected).
  11. */
  12. function at_core_submit_reponsive($values, $theme_name, $path) {
  13. global $path_to_at_core;
  14. // Set up some paths we use to get and save files
  15. $path_to_responsive_css = drupal_get_path('theme', $theme_name) . '/css/';
  16. $path_to_panels_css = $path_to_at_core . '/layouts/css/';
  17. // Initialize
  18. $smalltouch_landscape_panels_data = array();
  19. // Get the page layout config array
  20. $layout_variables = page_layout();
  21. // $layouts will hold all the page level layouts
  22. $layouts = array();
  23. // Initialize the $is_default_layout variable, we use this to test against
  24. $is_default_layout = $values['global_default_layout'];
  25. // Get the panels config array
  26. $rpl = responsive_panels_data_structure();
  27. // We need to add a float to some panels layouts in certain instances
  28. $float = ".at-panel .region {display:inline;float:left}";
  29. // Holds all styles from the responsive stylesheets
  30. $responsive_styles = array();
  31. $panel_subtypes = array();
  32. $panel_styles = array();
  33. // Get the values for the panels layouts
  34. unset($rpl['one']); // unset panels layout one, it has no layout data
  35. foreach ($rpl as $grouped => $panels_layout_groups) {
  36. foreach ($panels_layout_groups as $panel_layout_group) {
  37. foreach ($panel_layout_group as $group_items => $item_value) {
  38. $panel_subtypes[] = $item_value['theme'];
  39. if (array_key_exists('styles', $item_value)) {
  40. $panel_styles[] = $item_value['styles'];
  41. }
  42. }
  43. }
  44. }
  45. // If the Cascading media queries CSS file is enabled, load these styles first
  46. if ($values['enable_custom_media_queries'] === 1) {
  47. if (file_exists($path_to_responsive_css . 'responsive.custom.css')) {
  48. $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.custom.css', FALSE);
  49. $responsive_styles[] = $responsive_css . "\n";
  50. }
  51. }
  52. // Set variables for respond.js
  53. $load_respondjs = FALSE;
  54. if ($values['load_respondjs'] === 1) {
  55. $load_respondjs = TRUE;
  56. }
  57. // Set variables for onmediaquery.js and media_queries.js
  58. $responsive_js_css = '';
  59. $responsive_js = FALSE;
  60. if ($values['load_onmediaqueryjs'] === 1 && $values['disable_responsive_styles'] === 0) {
  61. $responsive_js = TRUE;
  62. }
  63. // Gutter width
  64. $gutters = "/* Gutters are not currently overridden in theme settings, but may be in theme CSS */";
  65. if (isset($values['enable_markup_overides']) && $values['enable_markup_overides'] === 1) {
  66. if (isset($values['global_gutter_width']) && is_numeric($values['global_gutter_width'])) {
  67. $gutter = check_plain($values['global_gutter_width']) . 'px';
  68. $gutters = "/* Gutters */" . "\n" . "#main-content,.block-inner,.pane-inner,.menu-wrapper,.branding-elements,.breadcrumb-wrapper,.attribution,.at-panel .rounded-corner,.block-panels-mini > .block-title,.rendered-by-ds .at-panel .region-inner,div.messages,.at-gutter {margin-left:$gutter;margin-right:$gutter;} #content .panel-display,#content .panel-flexible {margin-left:-$gutter;margin-right:-$gutter;}";
  69. }
  70. }
  71. // Smalltouch Portrait
  72. if ($values['smalltouch_portrait_media_query']) {
  73. $device = 'smalltouch_portrait';
  74. // Build an array of page layout settings values
  75. foreach ($layout_variables as $key => $value) {
  76. if (isset($values["$device" . '_' . "$value"])) {
  77. $smalltouch_portrait_layout_data[$value] = filter_xss_admin($values["$device" . '_' . "$value"]);
  78. }
  79. }
  80. // In smalltouch portrait we invoke the layout builder, but the values are not
  81. // used since the CSS is actually hard coded. I have done this because, at some
  82. // stage in the future this layout might not be hard coded and we might really
  83. // need to return a dynamically built layout. Note that $layout is only ever
  84. // used in desktop first - never in mobile first.
  85. $layout = at_build_page_layout($smalltouch_portrait_layout_data['layout'], $smalltouch_portrait_layout_data['sidebar_first'], $smalltouch_portrait_layout_data['sidebar_second'], $smalltouch_portrait_layout_data['sidebar_unit'], $theme_name);
  86. $method = $smalltouch_portrait_layout_data['layout'];
  87. $comment = "/* $device $method */\n";
  88. $width = "\n" . '.container {width:' . $smalltouch_portrait_layout_data['page_width'] . $smalltouch_portrait_layout_data['page_unit'] . '}';
  89. $media_query = $smalltouch_portrait_layout_data['media_query'];
  90. if ($responsive_js == TRUE) {
  91. $responsive_js_css = 'html {font-family: smalltouch_portrait} /* Font family for media_queries.js */';
  92. }
  93. // If mobile first then smalltouch portrait needs to do nothing, else its
  94. // problematic to set the layout later due to the cascade and inheritance
  95. if ($is_default_layout === 'smalltouch-portrait') {
  96. $css = '';
  97. // If responsive js is TRUE we output the media query with CSS styles
  98. if ($responsive_js == TRUE) {
  99. $css = $comment . '@media ' . $media_query . ' {' . "\n" . $responsive_js_css . "\n" . '}';
  100. }
  101. }
  102. else {
  103. // Smalltouch portrait panels are all 100% width and stacked, we need to
  104. // overpower the default layouts when in desktop first mode
  105. $smalltouch_portrait_panels_layout = '.at-panel .region,.at-panel .panel-row,.at-panel .panel-row .region,.at-panel .inset-wrapper{float:none;display:block;width:100%}';
  106. // Build the styles string
  107. $styles = $width . "\n" . $layout . "\n" . $smalltouch_portrait_panels_layout;
  108. // Reset styles if we are loading responsive js
  109. if ($responsive_js == TRUE) {
  110. $styles = "\n" . $responsive_js_css . "\n" . $width . "\n" . $layout . "\n" . $smalltouch_portrait_panels_layout;
  111. }
  112. // CSS wrapped in the media query
  113. $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}';
  114. }
  115. // Get and wrap the responsive CSS styles in the relative media query
  116. $responsive_smalltouch_portrait_css = '';
  117. if (file_exists($path_to_responsive_css . 'responsive.smalltouch.portrait.css')) {
  118. $responsive_smalltouch_portrait_css = $path_to_responsive_css . 'responsive.smalltouch.portrait.css';
  119. }
  120. // Legacy support for pre 7.x-3.2 subthemes
  121. elseif (file_exists($path_to_responsive_css . 'responsive.smartphone.portrait.css')) {
  122. $responsive_smalltouch_portrait_css = $path_to_responsive_css . 'responsive.smartphone.portrait.css';
  123. }
  124. if (!empty($responsive_smalltouch_portrait_css)) {
  125. $responsive_css = drupal_load_stylesheet($responsive_smalltouch_portrait_css, FALSE);
  126. $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}';
  127. }
  128. $layouts[] = $css;
  129. }
  130. // Smalltouch Landscape
  131. if ($values['smalltouch_landscape_layout']) {
  132. $device = 'smalltouch_landscape';
  133. // Build an array of page layout settings values
  134. foreach ($layout_variables as $key => $value) {
  135. if (isset($values["$device" . '_' . "$value"])) {
  136. $smalltouch_landscape_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]);
  137. }
  138. }
  139. $layout = at_build_page_layout($smalltouch_landscape_layout_data['layout'], $smalltouch_landscape_layout_data['sidebar_first'], $smalltouch_landscape_layout_data['sidebar_second'], $smalltouch_landscape_layout_data['sidebar_unit'], $theme_name);
  140. $method = $smalltouch_landscape_layout_data['layout'];
  141. $comment = "/* $device $method */\n";
  142. $width = "\n" . '.container {width:' . $smalltouch_landscape_layout_data['page_width'] . $smalltouch_landscape_layout_data['page_unit'] . '}';
  143. $media_query = $smalltouch_landscape_layout_data['media_query'];
  144. // Get the panel layout settings
  145. foreach ($panel_subtypes as $subtype) {
  146. $smalltouch_landscape_panel_settings[] = $device . '_' . $subtype;
  147. }
  148. foreach ($smalltouch_landscape_panel_settings as $setting) {
  149. if (!empty($values[$setting])) {
  150. $option = $values[$setting];
  151. }
  152. else {
  153. // Provide a fallback layout in case settings fail during submit
  154. $smalltouch_landscape_panel_substr_setting = substr($setting, 21);
  155. $smalltouch_landscape_panel_substr_setting = str_replace('_', '-', $smalltouch_landscape_panel_substr_setting) . '-stack';
  156. $option = $smalltouch_landscape_panel_substr_setting;
  157. }
  158. $smalltouch_landscape_panels_data[] = $option;
  159. }
  160. // Generate the panels layouts
  161. $smalltouch_landscape_panels_css = at_build_panels_layout_css($panel_styles, $smalltouch_landscape_panels_data);
  162. $panels_layouts = $float . $smalltouch_landscape_panels_css;
  163. // Build the styles string
  164. $styles = $width . "\n" . $layout . "\n" . $panels_layouts;
  165. // Reset styles if we are loading responsive js
  166. if ($responsive_js == TRUE) {
  167. $responsive_js_css = "\n" . 'html {font-family: smalltouch_landscape} /* Font family for media_queries.js */';
  168. $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts;
  169. }
  170. // CSS wrapped in the media query
  171. $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}';
  172. // Get and wrap the responsive CSS styles in the relative media query
  173. $responsive_smalltouch_landscape_css = '';
  174. if (file_exists($path_to_responsive_css . 'responsive.smalltouch.landscape.css')) {
  175. $responsive_smalltouch_landscape_css = $path_to_responsive_css . 'responsive.smalltouch.landscape.css';
  176. }
  177. // Legacy support for pre 7.x-3.2 subthemes
  178. elseif (file_exists($path_to_responsive_css . 'responsive.smartphone.landscape.css')) {
  179. $responsive_smalltouch_landscape_css = $path_to_responsive_css . 'responsive.smartphone.landscape.css';
  180. }
  181. if (!empty($responsive_smalltouch_landscape_css)) {
  182. $responsive_css = drupal_load_stylesheet($responsive_smalltouch_landscape_css, FALSE);
  183. $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}';
  184. }
  185. $layouts[] = $css;
  186. }
  187. // Tablet Portrait
  188. if ($values['tablet_portrait_layout']) {
  189. $device = 'tablet_portrait';
  190. // Build an array of page layout settings values
  191. foreach ($layout_variables as $key => $value) {
  192. if (isset($values["$device" . '_' . "$value"])) {
  193. $tablet_portrait_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]);
  194. }
  195. }
  196. // Workaround upgrade issues for some settings
  197. if ($tablet_portrait_layout_data['layout'] == 'two_col_stack') {
  198. $tablet_portrait_layout_data['layout'] = 'two_sidebars_right_stack';
  199. }
  200. $layout = at_build_page_layout($tablet_portrait_layout_data['layout'], $tablet_portrait_layout_data['sidebar_first'], $tablet_portrait_layout_data['sidebar_second'], $tablet_portrait_layout_data['sidebar_unit'], $theme_name);
  201. $method = $tablet_portrait_layout_data['layout'];
  202. $comment = "/* $device $method */\n";
  203. $width = "\n" . '.container {width:' . $tablet_portrait_layout_data['page_width'] . $tablet_portrait_layout_data['page_unit'] . '}';
  204. $media_query = $tablet_portrait_layout_data['media_query'];
  205. $tablet_portrait_panel_settings = array();
  206. $tablet_portrait_panels_data = array();
  207. // Get the panel layout settings and CSS for these layouts
  208. foreach ($panel_subtypes as $subtype) {
  209. $tablet_portrait_panel_settings[] = $device . '_' . $subtype;
  210. }
  211. foreach ($tablet_portrait_panel_settings as $setting) {
  212. if (!empty($values[$setting])) {
  213. $option = $values[$setting];
  214. }
  215. else {
  216. // Provide a fallback layout in case settings fail during submit
  217. $tablet_portrait_panel_substr_setting = substr($setting, 16);
  218. $tablet_portrait_panel_substr_setting = str_replace('_', '-', $tablet_portrait_panel_substr_setting);
  219. $option = $tablet_portrait_panel_substr_setting;
  220. }
  221. $tablet_portrait_panels_data[] = $option;
  222. }
  223. // Generate the panels layouts
  224. $tablet_portrait_panels_css = at_build_panels_layout_css($panel_styles, $tablet_portrait_panels_data);
  225. $panels_layouts = $float . $tablet_portrait_panels_css;
  226. // Build the styles string
  227. $styles = $width . "\n" . $layout . "\n" . $panels_layouts;
  228. // Reset styles if we are loading responsive js
  229. if ($responsive_js == TRUE) {
  230. $responsive_js_css = "\n" . 'html {font-family: tablet_portrait} /* Font family for media_queries.js */';
  231. $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts;
  232. }
  233. // CSS wrapped in the media query
  234. $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}';
  235. // Get and wrap the responsive CSS styles in the relative media query
  236. if (file_exists($path_to_responsive_css . 'responsive.tablet.portrait.css')) {
  237. $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.tablet.portrait.css', FALSE);
  238. $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}';
  239. }
  240. $layouts[] = $css;
  241. }
  242. // Tablet Landscape
  243. if ($values['tablet_landscape_layout']) {
  244. $device = 'tablet_landscape';
  245. // Build an array of page layout settings values
  246. foreach ($layout_variables as $key => $value) {
  247. if (isset($values["$device" . '_' . "$value"])) {
  248. $tablet_landscape_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]);
  249. }
  250. }
  251. // Workaround upgrade issues for some settings
  252. if ($tablet_portrait_layout_data['layout'] == 'two_col_stack') {
  253. $tablet_portrait_layout_data['layout'] = 'two_sidebars_right_stack';
  254. }
  255. $layout = at_build_page_layout($tablet_landscape_layout_data['layout'], $tablet_landscape_layout_data['sidebar_first'], $tablet_landscape_layout_data['sidebar_second'], $tablet_landscape_layout_data['sidebar_unit'], $theme_name);
  256. $method = $tablet_landscape_layout_data['layout'];
  257. $comment = "/* $device $method */\n";
  258. $width = "\n" . '.container {width:' . $tablet_landscape_layout_data['page_width'] . $tablet_landscape_layout_data['page_unit'] . '}';
  259. $media_query = $tablet_landscape_layout_data['media_query'];
  260. // Get the panel layout settings
  261. foreach ($panel_subtypes as $subtype) {
  262. $tablet_landscape_panel_settings[] = $device . '_' . $subtype;
  263. }
  264. foreach ($tablet_landscape_panel_settings as $setting) {
  265. if (!empty($values[$setting])) {
  266. $option = $values[$setting];
  267. }
  268. else {
  269. // Provide a fallback layout in case settings fail during submit
  270. $tablet_landscape_panel_substr_setting = substr($setting, 17);
  271. $tablet_landscape_panel_substr_setting = str_replace('_', '-', $tablet_landscape_panel_substr_setting);
  272. $option = $tablet_landscape_panel_substr_setting;
  273. }
  274. $tablet_landscape_panels_data[] = $option;
  275. }
  276. // Generate the panels layouts
  277. $tablet_landscape_panels_css = at_build_panels_layout_css($panel_styles, $tablet_landscape_panels_data);
  278. $panels_layouts = $float . $tablet_landscape_panels_css;
  279. // Build the styles string
  280. $styles = $width . "\n" . $layout . "\n" . $panels_layouts;
  281. // Reset styles if we are loading responsive js
  282. if ($responsive_js == TRUE) {
  283. $responsive_js_css = "\n" . 'html {font-family: tablet_landscape} /* Font family for media_queries.js */';
  284. $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts;
  285. }
  286. // CSS wrapped in the media query
  287. $css = $comment . '@media ' . $media_query . ' {' . $styles . "\n" . '}';
  288. // Get and wrap the responsive CSS styles in the relative media query
  289. if (file_exists($path_to_responsive_css . 'responsive.tablet.landscape.css')) {
  290. $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.tablet.landscape.css', FALSE);
  291. $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}';
  292. }
  293. $layouts[] = $css;
  294. }
  295. // Standard Layout (bigscreen)
  296. if ($values['bigscreen_layout']) {
  297. $device = 'bigscreen';
  298. // Build an array of page layout settings values
  299. foreach ($layout_variables as $key => $value) {
  300. if (isset($values["$device" . '_' . "$value"])) {
  301. $bigscreen_layout_data[$value] = check_plain($values["$device" . '_' . "$value"]);
  302. }
  303. }
  304. $layout = at_build_page_layout($bigscreen_layout_data['layout'], $bigscreen_layout_data['sidebar_first'], $bigscreen_layout_data['sidebar_second'], $bigscreen_layout_data['sidebar_unit'], $theme_name);
  305. $method = $bigscreen_layout_data['layout'];
  306. $comment = "/* $device $method */";
  307. $width = "\n" . '.container {width:' . $bigscreen_layout_data['page_width'] . $bigscreen_layout_data['page_unit'] . '}';
  308. $media_query = $bigscreen_layout_data['media_query'];
  309. // Standard layout can have a max-width
  310. if ($values['bigscreen_set_max_width'] === 1 && $bigscreen_layout_data['page_unit'] === '%') {
  311. if (!empty($values['bigscreen_max_width'])) {
  312. $width = "\n" . '.container {width:' . $bigscreen_layout_data['page_width'] . $bigscreen_layout_data['page_unit'] . ';max-width:' . $values['bigscreen_max_width'] . $values['bigscreen_max_width_unit'] . '}';
  313. }
  314. else {
  315. $width = "\n" . '.container {width:' . $bigscreen_layout_data['page_width'] . $bigscreen_layout_data['page_unit'] . ';max-width:' . $values['bigscreen_max_width'] . $values['bigscreen_max_width_unit'] . '}';
  316. }
  317. }
  318. $bigscreen_panels_data = array();
  319. // Get the panel layout settings
  320. foreach ($panel_subtypes as $subtype) {
  321. $bigscreen_panel_settings[] = $device . '_' . $subtype;
  322. }
  323. foreach ($bigscreen_panel_settings as $setting) {
  324. if (!empty($values[$setting])) {
  325. $option = $values[$setting];
  326. }
  327. else {
  328. // Provide a fallback layout in case settings fail during submit
  329. $bigscreen_panel_substr_setting = substr($setting, 16);
  330. $bigscreen_panel_substr_setting = str_replace('_', '-', $bigscreen_panel_substr_setting);
  331. $option = $bigscreen_panel_substr_setting;
  332. }
  333. $bigscreen_panels_data[] = $option;
  334. }
  335. // Generate the panels layouts
  336. $bigscreen_panels_css = at_build_panels_layout_css($panel_styles, $bigscreen_panels_data);
  337. // Prepend the float
  338. $panels_layouts = $float . $bigscreen_panels_css;
  339. // Build the styles string
  340. $styles = $width . "\n" . $layout . "\n" . $panels_layouts;
  341. // Reset styles if we are loading responsive js
  342. if ($responsive_js == TRUE) {
  343. $responsive_js_css = "\n" . 'html {font-family: standard} /* Font family for media_queries.js */';
  344. $styles = $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts;
  345. }
  346. // We need to do some conditional checks to account for the users settings:
  347. // - is this mobile first or desktop first?
  348. // - is the responsive capability disabled?
  349. // Mobile first or Desktop first?
  350. if ($is_default_layout === 'standard-layout') {
  351. // DESKTOP FIRST
  352. // Just the responsive js font family
  353. $css = '';
  354. if ($responsive_js == TRUE) {
  355. $css = $comment . "\n" . '@media ' . $media_query . ' {' . $responsive_js_css . "\n" . '}';
  356. }
  357. // Prepare a "default layout" for output to file when desktop first
  358. $desktop_first_layout = $gutters . "\n" . $comment . $styles . "\n";
  359. }
  360. else {
  361. // MOIBLE FIRST
  362. $css = $comment . "\n" . '@media ' . $media_query . ' {' . $styles . "\n" . '}';
  363. $desktop_first_layout = '/* Not likely, this is mobile first - this themer is rocking the hardest! */';
  364. }
  365. // Responsive capability OFF?
  366. if ($values['disable_responsive_styles'] === 1) {
  367. // If its off we have to load something, so we choose to use the bigscreen
  368. // layout and load that
  369. $desktop_first_layout = $gutters . "\n" . $comment . $styles;
  370. }
  371. // add $css to the layouts array
  372. $layouts[] = $css;
  373. }
  374. //****** END bigscreen layout ******//
  375. // Internet Exploder
  376. // We only want to load what is absolutely required for IE, depending on the
  377. // theme settings and what version we are targeting, remember, this only takes
  378. // care of generating the stylesheets so what you see here are lots of messages
  379. // being set for the themer to get a handle on what is going on, load.inc and
  380. // adaptivetheme_preprocess_html() are actually loading the files.
  381. // $lt_ie9_css's assigned values all come from the bigscreen layout, since its
  382. // the last layout to assign values to those variables
  383. $lt_ie9_css = $comment . $width . "\n" . $layout . "\n" . $panels_layouts;
  384. // Reset $lt_ie9_css if we are loading responsive js
  385. if ($responsive_js == TRUE) {
  386. $lt_ie9_css = $comment . $responsive_js_css . $width . "\n" . $layout . "\n" . $panels_layouts;
  387. }
  388. // Get the lt ie8 panels layouts if enabled
  389. $lt_ie8_css = '/* IE6/7 percentage rounding error fixes are OFF */';
  390. if ($values['load_ltie8css'] === 1) {
  391. $ie_panels_layouts = drupal_load_stylesheet($path_to_panels_css . 'ie_defaults.css', FALSE);
  392. $lt_ie8_css = $ie_panels_layouts;
  393. }
  394. // Respond.js is OFF
  395. if ($load_respondjs == FALSE) {
  396. // should we load the IE6/7 rounding error fixes?
  397. if ($values['load_ltie8css'] === 1) {
  398. // add the E6/7 rounding error fixes to $lt_ie9_css, set a message in $lt_ie8_css
  399. $lt_ie9_css = $comment . $width . "\n" . $layout . "\n" . $panels_layouts . "\n" . $ie_panels_layouts;
  400. $lt_ie8_css = '/* The IE6/7 panels layouts are loading in the lt IE9 CSS, to save an HTTP request hit on your server */';
  401. // Desktop first?
  402. if ($is_default_layout === 'standard-layout') {
  403. // repopulate $lt_ie8_css
  404. $lt_ie8_css = $ie_panels_layouts;
  405. }
  406. }
  407. }
  408. // Respond.js is ON
  409. if ($load_respondjs == TRUE) {
  410. $lt_ie9_css = '/* respond.js is loading so we dont load this file. IE6, 7 and 8 will rely on respond.js to work its magic */';
  411. }
  412. // Desktop first?
  413. if ($is_default_layout === 'standard-layout') {
  414. $lt_ie9_css = '/* The standard layout is the default layout, IE styles are not required because you are doing desktop first design */';
  415. }
  416. // Responsive capability OFF?
  417. if ($values['disable_responsive_styles'] === 1) {
  418. $lt_ie9_css = '/* Responsive capabilites are disabled, we no longer need to load an IE specific layout */';
  419. }
  420. // Get and wrap the responsive CSS styles in the relative media query
  421. if (file_exists($path_to_responsive_css . 'responsive.desktop.css')) {
  422. $responsive_css = drupal_load_stylesheet($path_to_responsive_css . 'responsive.desktop.css', FALSE);
  423. $responsive_styles[] = '@media ' . $media_query . ' {' . "\n" . $responsive_css . "\n" . '}';
  424. }
  425. // Generate the layout and responsive styles stylesheets
  426. // Here we generate five files:
  427. // 1. $theme_name.default.layout
  428. // 2. $theme_name.responsive.layout
  429. // 3. $theme_name.lt-ie9.layout
  430. // 4. $theme_name.lt-ie8.layout
  431. // 5. $theme_name.responsive.styles
  432. // adaptivetheme_preprocess_html() will take care of loading the right ones
  433. // when they are needed.
  434. // responsive layout
  435. $responsive_layout_data = implode("\n", $layouts);
  436. // Prepend the gutters to the responsive layout if we're doing mobile first
  437. if ($is_default_layout !== 'standard-layout') {
  438. $responsive_layout = $gutters . "\n" . $responsive_layout_data;
  439. }
  440. else {
  441. $responsive_layout = $responsive_layout_data;
  442. }
  443. // Nuke $responsive_layout if we really don't need it
  444. if ($values['disable_responsive_styles'] == 1) {
  445. $responsive_layout = '/* Responsive capabilites are disabled, only the standard layout is loaded in themename.default.layout.css */';
  446. }
  447. // IE assignments, not sure why I am doing this, could be that I meant to do
  448. // something at this stage and have forgotton for now...
  449. $lt_ie9_layout = $lt_ie9_css;
  450. $lt_ie8_layout = $lt_ie8_css;
  451. // Aggregate the design stylesheets
  452. $responsive_css = implode("\n", $responsive_styles);
  453. // Regex relative paths. This mimics Drupal cores drupal_build_css_cache(), but
  454. // its not as powerful because assets must be relative to the theme root.
  455. $_base = base_path() . $path_to_responsive_css;
  456. _drupal_build_css_path(NULL, $_base);
  457. $responsive_css = preg_replace_callback('/url\(\s*[\'"]?(?![a-z]+:|\/+)([^\'")]+)[\'"]?\s*\)/i', '_drupal_build_css_path', $responsive_css);
  458. // Build a keyed array: file names as key, layout data as value
  459. $files = array(
  460. "$theme_name.default.layout" => $desktop_first_layout,
  461. "$theme_name.responsive.layout" => $responsive_layout,
  462. "$theme_name.lt-ie9.layout" => $lt_ie9_layout,
  463. "$theme_name.lt-ie8.layout" => $lt_ie8_layout,
  464. "$theme_name.responsive.styles" => $responsive_css,
  465. );
  466. // Loop over the array and save each file, and we're done!
  467. foreach ($files as $key => $value) {
  468. $filepath = "$path/$key.css";
  469. file_unmanaged_save_data($value, $filepath, FILE_EXISTS_REPLACE);
  470. }
  471. }
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.