Maintaining the Mayo theme for Drupal 8 beta 4 and I get the attached notice and warnings that weren't there in Drupal 8 beta 3. I'm pretty sure that the errors are related to this issue https://www.drupal.org/node/2390707 which removed hook_library_alter(). I reverted the patch in #3 there and the issue is gone. After that I went back to the patched color.module and the issue didn't come back for unknown reasons.
I did separate intall of Drupal 8 alpha 4 and Mayo 8 dev and the errors are there again.
The problem does not arise with Bartik as far as I can tell so contributed themes may have to do some adjusting. The problem seems to come from mayo.libraries.yml and the color.preview library.
color.preview:
version: VERSION
css:
theme:
color/preview.css: {}
css/admin-layout-settings.css: {}
js:
color/preview.js: {}
js/mayo.js: {}
dependencies:
- color/drupal.color
- core/drupalSettings
The library is being called at the bottom of themes/mayo/color/color.inc with 'preview_library' => 'mayo/color.preview',
Comment | File | Size | Author |
---|---|---|---|
#10 | undefined_index_css_notice-2404253-10-whole.patch | 4.14 KB | wuinfo - Bill Wu |
#10 | undefined_index_css_notice-2404253-10-test.patch | 1.14 KB | wuinfo - Bill Wu |
#4 | undefined_index_css_notice-2404253-4.patch | 2.99 KB | mermentau |
warning.png | 149.57 KB | mermentau | |
notice.png | 149.24 KB | mermentau |
Comments
Comment #1
ianthomas_ukI can't see anything obviously wrong with either the module or the patch. Have you confirmed exactly which library is causing the problem?
For example, use a debugger or just above line 81 of color.module you could put:
I've set this to a support request until we've confirmed if/what the bug in core actually is.
Comment #2
mermentau CreditAttribution: mermentau commentedThe original errors in the attached images indicated the color.preview library, but the debug snip in #1 pointed to the mayo-columns library. The full mayo.libraries.yml file is here:
Commenting out the color.preview library causes the error message to point to the global-styling library.
As it stands now the color module copies css/colors.css properly to public:// and everything seems to work except for the nagging "warning" and "notice" messages.
Remember this all works when I role the core patch back so possibly something will have to be adjusted to use the new color_library_info_alter(), but I can't seem to find what that is.
Comment #3
mermentau CreditAttribution: mermentau commentedChanged the version as I tested with the core dev (1/25/2015) and the same result.
Comment #4
mermentau CreditAttribution: mermentau commentedIt looks like color.module is looking through all Mayo's libraries and the ones with no css are giving this "Notice". All the Bartik libraries have css so it doesn't produce the "Notice". A small
if(isset($libraries[$name]['css'])) {
addition seems to fix the problem. Attached is my first core patch attempt.Comment #5
mermentau CreditAttribution: mermentau commentedComment #6
Fabianx CreditAttribution: Fabianx commentedThis should be good.
Comment #7
Wim LeersPatch looks good.
Missing space after "if".
Can be fixed upon commit.
Comment #8
alexpottColor module is not blessed with many tests which is why we inadvertently break it :(
Comment #10
wuinfo - Bill Wu CreditAttribution: wuinfo - Bill Wu commentedI have added a test for this bug. The additional test code itself is quite simple. I just added a dummy library to the color_test_theme YML file to mimic the real-life situation.
Comment #11
Fabianx CreditAttribution: Fabianx as a volunteer commentedRTBC - if tests fail and pass :).
Comment #13
alexpottCommitted 6c2eb9c and pushed to 8.0.x. Thanks!
The javascript added by this patch does not confirm to our javascript standards as determined by eslint.
Fix coding standards.