At about line 637 of color.module are these lines:
// Cut out slices.
foreach ($info['slices'] as $file => $coord) {
The Color module uses filenames as the keys of an array that specifies images slices.
Dots in array keys have been banned in 8.x. This issue #2293773: Field allowed values use dots in key names - not allowed in config and change record Dots are explicitly forbidden in configuration data keys now explain the situation.
The behavior can be seen in the Garland theme's color/color.inc
file, starting at about line 192:
// Coordinates of all the theme slices (x, y, width, height)
// with their filename as used in the stylesheet.
'slices' => array(
'images/body.png' => array(0, 37, 1, 280),
'images/bg-bar.png' => array(202, 530, 76, 14),
'images/bg-bar-white.png' => array(202, 506, 76, 14),
'images/bg-tab.png' => array(107, 533, 41, 23),
'images/bg-navigation.png' => array(0, 0, 7, 37),
'images/bg-content-left.png' => array(40, 117, 50, 352),
'images/bg-content-right.png' => array(510, 117, 50, 352),
'images/bg-content.png' => array(299, 117, 7, 200),
'images/bg-navigation-item.png' => array(32, 37, 17, 12),
'images/bg-navigation-item-hover.png' => array(54, 37, 17, 12),
'images/gradient-inner.png' => array(646, 307, 112, 42),
'logo.png' => array(622, 51, 64, 73),
'screenshot.png' => array(0, 37, 400, 240),
),
Changing the color scheme of a theme that uses the color module in this way generates an error message similar to this:
Error
Status message
The configuration options have been saved.
The website has encountered an error. Please try again later.
and a watchdog log message similar to this:
Drupal\Core\Config\ConfigValueException: images/body.png key contains a dot which is not supported. in Drupal\Core\Config\ConfigBase->validateKeys() (line 217 of /path/to/drupal/8.0.x/core/lib/Drupal/Core/Config/ConfigBase.php).
Some re-architecting will need to be done in that function to come up with a way of specifying filenames without using dots.
Comment | File | Size | Author |
---|---|---|---|
#5 | 2380641_warnings.png | 290.34 KB | Anonymous (not verified) |
#4 | color_module_image_method-2380641-4.patch | 1.24 KB | oadaeh |
#2 | color_module_image_method-2380641-2.patch | 1.22 KB | oadaeh |
Comments
Comment #1
oadaeh CreditAttribution: oadaeh commentedI think I have an idea no how to fix this with a minimal amount of disruption.
Comment #2
oadaeh CreditAttribution: oadaeh commentedI've modified the module such that themes that use the color module in this way will have to modify their slices array so they look like this (using the Garland example above):
Patch attached.
I guess tests need to be created for this, since it wasn't caught before now.
Comment #3
oadaeh CreditAttribution: oadaeh commentedComment #4
oadaeh CreditAttribution: oadaeh commentedRe-roll for recent changes. It still needs tests.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedAfter applying your patch, I receive a lot of warnings. I suspect it's due to the changed structure.
Screenshot of the warnings attached.
Comment #6
oadaeh CreditAttribution: oadaeh as a volunteer commented@pjonckiere, I just applied the patch in comment #4 to the latest code in dev (just downloded), and I'm not getting those messages. Which theme are you using? What other changes did you make?
Comment #7
oadaeh CreditAttribution: oadaeh as a volunteer commentedResetting to try to get a re-test.
Comment #9
ragnarkurm CreditAttribution: ragnarkurm as a volunteer commentedInstalled Garland (8.x-1.0-alpha6) on Drupal 8.x-dev.
After applying the #4 patch, got errors as mentioned by @pjonckiere in #5.
After fixing corresponding Garland data structure as in #2 got rid of errors.
Color module generated images are correct in files/colors/garland-xxxxxxxx/
I did not get custom colors shown in actual Garland-themed page,
Suspecting this is Garland issue rather than the Color module's.
I copied garland/css/style.css to garland/style.css and some custom colors appeared.
Comment #10
joachim CreditAttribution: joachim commentedGarland hasn't yet been updated for D8 color module support -- partly because this issue isn't resolved yet, in fact.
Comment #11
borisson_Back to needs work as tests still need to be added.
Comment #12
catchComment #13
lokapujyacannot reproduce the error.
Comment #16
Wim LeersWhen changing the color scheme of the Bartik theme, I cannot reproduce this: