Commit e5b19737 authored by alexpott's avatar alexpott

Issue #2010636 by mcjim, Wim Leers, typhonius: Remove drupal_add_css() and...

Issue #2010636 by mcjim, Wim Leers, typhonius: Remove drupal_add_css() and drupal_add_js() from color.module — use #attached.
parent 2644090a
......@@ -236,17 +236,17 @@ function color_scheme_form($complete_form, &$form_state, $theme) {
* - form: A render element representing the form.
*/
function template_preprocess_color_scheme_form(&$variables) {
$form = $variables['form'];
$form = &$variables['form'];
$theme = $form['theme']['#value'];
$info = $form['info']['#value'];
$path = drupal_get_path('theme', $theme) . '/';
drupal_add_css($path . $info['preview_css']);
// @todo Transform to add library.
$preview_css_path = $path . $info['preview_css'];
$preview_js_path = isset($info['preview_js']) ? $path . $info['preview_js'] : drupal_get_path('module', 'color') . '/' . 'preview.js';
$form['scheme']['#attached']['css'][$preview_css_path] = array();
// Add the JS at a weight below color.js.
drupal_add_js($preview_js_path, array('weight' => -1));
$form['scheme']['#attached']['js'][$preview_js_path] = array('weight' => -1);
// Attempt to load preview HTML if the theme provides it.
$preview_html_path = DRUPAL_ROOT . '/' . (isset($info['preview_html']) ? drupal_get_path('theme', $theme) . '/' . $info['preview_html'] : drupal_get_path('module', 'color') . '/preview.html');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment