Skip to content
Snippets Groups Projects
Commit e5b19737 authored by Alex Pott's avatar Alex Pott
Browse files

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
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment