Commit 3cd09437 authored by alexpott's avatar alexpott

Issue #2548991 by Wim Leers, Mile23: Remove Bartik's erroneous use of...

Issue #2548991 by Wim Leers, Mile23: Remove Bartik's erroneous use of drupal_process_attached(), add tests
parent 40ad8eef
......@@ -259,6 +259,10 @@ function color_scheme_form($complete_form, FormStateInterface $form_state, $them
}
}
$form['theme'] = array('#type' => 'value', '#value' => $theme);
if (isset($info['#attached'])) {
$form['#attached'] = $info['#attached'];
unset($info['#attached']);
}
$form['info'] = array('#type' => 'value', '#value' => $info);
return $form;
......
......@@ -177,4 +177,21 @@ function testValidColor() {
}
}
}
/**
* Test whether the custom logo is used in the color preview.
*/
function testLogoSettingOverride() {
$this->drupalLogin($this->bigUser);
$edit = array(
'default_logo' => FALSE,
'logo_path' => 'core/misc/druplicon.png',
);
$this->drupalPostForm('admin/appearance/settings', $edit, t('Save configuration'));
// Ensure that the overridden logo is present in Bartik, which is colorable.
$this->drupalGet('admin/appearance/settings/bartik');
$this->assertIdentical($GLOBALS['base_url'] . '/' . 'core/misc/druplicon.png', $this->getDrupalSettings()['color']['logo']);
}
}
......@@ -5,10 +5,6 @@
* Lists available colors and color schemes for the Bartik theme.
*/
// Put the logo path into JavaScript for the live preview.
$js_attached['#attached']['drupalSettings']['color']['logo'] = theme_get_setting('logo.url', 'bartik');
drupal_process_attached($js_attached);
$info = array(
// Available colors and color labels used in theme.
'fields' => array(
......@@ -121,4 +117,14 @@
// Preview files.
'preview_library' => 'bartik/color.preview',
'preview_html' => 'color/preview.html',
// Attachments.
'#attached' => [
'drupalSettings' => [
'color' => [
// Put the logo path into JavaScript for the live preview.
'logo' => theme_get_setting('logo.url', 'bartik'),
],
],
],
);
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