Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Clearing cache on Skin settings page (admin/appearance/skinr/skins/settings/%) causes errors default groups from skinr_skinr_group_info() to not get loaded. The errors are evident as notices on Skins listing page (admin/appearance/skinr/skins).
Comment | File | Size | Author |
---|---|---|---|
#33 | patch_commit_7c831e83210e.patch | 106.44 KB | moonray |
#32 | patch_commit_32086bf9fe14.patch | 37.37 KB | moonray |
#30 | patch_commit_26cbc0bdeda8.patch | 15.78 KB | moonray |
#25 | patch_commit_077228b11a02.patch | 11.71 KB | moonray |
#23 | patch_commit_a899d8ae3f71.patch | 93.5 KB | moonray |
Comments
Comment #1
moonray CreditAttribution: moonray commentedThis looks to be due to
skinr_ui_skin_info_load()
being run beforeskinr_init()
.Comment #2
sunBefore hook_init() means before full bootstrap. This should not happen.
Add a ddebug_backtrace() to skinr_ui_skin_info_load() to see who or what is attempting to theme() something before full bootstrap.
Comment #3
moonray CreditAttribution: moonray commentedThis is what the backtraces tell me:
It looks legit, but it doesn't give us the desired execution order.
Comment #4
sunmmm, I don't see how or where menu_get_custom_theme() would or could invoke skinr_ui_skin_info_load(). There must be some intermediary function(s) in between, no? Can you attach a full debug_backtrace() as a .txt file attachment?
(Ideally, we'd have a function in core that allows to output a simplified backtrace; reminds me to continue work on #1158322: Add backtrace to all errors)
Comment #5
moonray CreditAttribution: moonray commentedHere are the backtrace functions:
1. drupal_bootstrap [line: 21]
2. _drupal_bootstrap_full [line: 2056]
3. menu_set_custom_theme [line: 4935]
4. menu_get_custom_theme [line: 1689]
5. menu_get_item [line: 1674]
6. _menu_translate [line: 451]
7. _menu_load_objects [line: 744]
8. skinr_ui_skin_info_load [line: 577]
I've also attached the full backtrace.
Comment #6
moonray CreditAttribution: moonray commentedEDIT: removed double post.
Comment #7
ChrisBryant CreditAttribution: ChrisBryant commentedI'm not sure why, but for some reason the link to the uploaded backtrace.txt file has a path of just "http://drupal.org/files/issues/" which makes it not link. The file appears to have been uploaded though:
http://drupal.org/files/issues/backtrace_12.txt
Unfortunately I can't offer any further help with this issue. :-)
Comment #8
sunSee end of _drupal_bootstrap_full().
This is more or less expected behavior, as far as I can see.
However, this means that hook_init() was not invoked yet, but all modules are loaded already. So I don't really understand why Skinr has a problem with that, and why default groups from skinr_skinr_group_info() cannot be loaded?
Comment #9
moonray CreditAttribution: moonray commentedskinr_load_includes() which loads the *.skinr.inc (where skinr_skinr_group_info() resides) is run by skinr_init().
So, unless hook_init() is run, skinr_skinr_group_info() doesn't exist, and a version of loaded groups without our default skinr groups is cached.
Comment #10
sunwell, there's a big phat @todo for skinr_init() which deserves to be resolved in the first place. ;)
Comment #11
sunAnd a similarly big one for skinr_load_includes().
All of this manual, unconditional loading of each and every Skinr support file shouldn't be required anymore. That's why we revamped Skinr's plugin API. If it's still needed for any reason, then we need to fix that.
Comment #12
moonray CreditAttribution: moonray commentedYou've left out
skinr_load_includes()
in your patch, which loadsmodules/block.skinr.inc
, etc. They can't be loaded usingmodule_load_include('inc', 'skinr', 'skinr.handlers')
because they're not in their own modules' dirs. That was the reason we left in the functions that run onhook_init()
in the first place.Comment #13
sunThe already existing skinr_implements() (and skinr_load_plugins()) should auto-load everything that is needed, and only if it is needed.
The global, unconditional loading of include files needs to go. For that sake, the built-in API hooks for core modules already register themselves with:
In turn, this should work already. If it doesn't, we need to find out why, and fix it.
Comment #14
moonray CreditAttribution: moonray commentedThis actually only works on the first run (due to caching). After that the files aren't loaded...
e.g. for modules/block.skinr.inc, block_skinr_config_info() is run and cached when skinr_implements() is run. But the function callbacks registered in that module probably need to be standardized so they can be included skinr_hook_info() to ensure auto-loading when required.
EDIT: #1044222: Remove skin configuration functionality from third-party forms, thought closed has pertinent information.
Comment #15
moonray CreditAttribution: moonray commentedSince we're going to have to deal with the API changes to get this bug fixed, I'm reposting relevant info from #1044222: Remove skin configuration functionality from third-party forms comments #16 and #18.
by @moonray:
We have the following callbacks left after this last patch:
[EDIT] The reason we're using $form and $form_state as arguments is due to legacy functionality; we were adding this form to third party edit forms. We can most likely streamline this now. This callback is called from within skinr_ui_form_alter() which adds creates the widgets form skinr plugin provided skins and groups.
[EDIT] This is used to add the 'edit skin' link to contextual menus for each block. The reason we used a callback here instead of relying on hook_contextual_links_view_alter() is due to modules like panels having their own slightly wonky (custom) version of contextual menus for panel panes.
by @sun
I'd have to have a closer look at the current code. However, it would be ideal if we could write down something along the lines of #16 in the new issue - but with some more essential details; for example, (not having looked at the code yet) the purpose of contextual_links_handler is not clear to me - I don't understand why some other module has to deal or assist with contextual links for Skinr UI at all. In such cases, we should also clarify the difference to having modules simply implement hook_contextual_links_view_alter() instead, or why that wouldn't be feasible.
The goal should be to have a single hook_skinr_config_info() [or whatever it was/is named] with clear and concise info properties being returned, and most of the module integration information being cached or cacheable. If something is based on dynamic values (retrieval/assignment), then there should be a dedicated hook that is being invoked, getting clear function arguments (for example, passing $form and $form_state to a preprocess_hook_callback is... highly confusing for me). Ideally, there should be default implementations provided by Skinr itself for the 80% use-case, so most module integration code doesn't have to implement common logic.
Comment #16
sunAttached patch cleanly reproduces #14 in a test.
Sorry, contains "commented out" tests for faster debugging, to be reverted in final patch.
Comment #17
sunAttached patch fixes this issue.
Yay for resolving a bunch of @todos and introducing an entire new stack of @todos at the same time! ;)
Comment #18
sunFixed testSkinrImplements().
Comment #19
sunSorry for the noise. Removed stale code and added some clarifying comments/todos.
Comment #20
moonray CreditAttribution: moonray commentedAttached patch gets rid of all the crazy skinr_handlers.
What we're left with is the following hooks:
Things that still need doing for this patch:
DRUPAL_ROOT . '/' . drupal_get_path('module', $module) . "/$name.$type";
.EDIT 2: One possible solution to this problem seems to be forking module_invoke_all(), but that sounds rather awful.
I would like some feedback on this patch in the meantime, though, since it's a pretty radical change.
EDIT: We might also need a hook_skinr_elements_alter() function?
Comment #21
moonray CreditAttribution: moonray commentedLooks like I was using an old patch from sun as a base. Updated to use sun's last patch in #19.
Comment #22
moonray CreditAttribution: moonray commentedIt appears I broke sun's fix in #19. Setting to needs work.
Comment #23
moonray CreditAttribution: moonray commentedSee comment #20 for the remaining to-dos.
Comment #24
sunThanks for the major clean-up, @moonray!
However, I think that we should commit #19 first, and do the major rewrite of the module integration hooks only afterwards, possibly in a separate issue. I'd have a couple of remarks/objections on the current patch. To me it looks like #19 is a first step towards resolving/removing the global unconditional auto-loading, highlighting where things are still wrong, and/but to resolve the remaining bits, we need to change the module integration API hooks entirely, like you attempted to do in #20 onwards. As far as I can see, the changes complement each other, so as soon as #19 is in, we can move on with #23?
Comment #25
moonray CreditAttribution: moonray commented#19 is still giving me a bunch of errors in the tests.
Attached patch (based on #19) fixes that by loading skinr.handlers.inc when those functions are due to be called in skinr_handler(). When we get rid of the handlers, this will go with it.
We still have the problem with panels' include, as I pointed out in #23, point 1:
Comment #26
coltrane#25 seems to work fine with my example skin but a bunch of tests are failing.
Also, I'm unclear what is meant with the statements about including files and caching:
Are you saying this include_once should be removed and all includes go through skinr_load_includes()?
What is this code that is not using the cache? skinr_get_config_info() is loading from cache.
Comment #27
sunThose @todos are mine, and we need to resolve them. Ideally, in this issue, after committing this patch.
Would be lovely to squeeze in a @todo here prior to committing this patch.
Comment #28
moonray CreditAttribution: moonray commentedThis still leaves us with broken panels support, which is not very cool (see#23, point 1, which applies to the first patch as well, not just my patch in #23).
Comment #29
moonray CreditAttribution: moonray commentedThe only thing I can think of to fix that panels issue is to create a new skinr_panels.module.
@sun, @coltrane: do you think that's an acceptable compromise, or is there possibly a better option?
Comment #30
moonray CreditAttribution: moonray commentedAttached is a patch that makes everything work, but I'm not happy about the way it's done due to it including code specific for panels (why does it always have to do thing differently form the rest of Drupal?).
Please review, and hopefully suggest a better approach. Or is my observation in #29 the only 'good' option?
Comment #31
moonray CreditAttribution: moonray commentedI decided to break out the panels functionality into its own module to prevent polluting Skinr API with panels specific hacks (and they are hacks). The new skinr_panels module will be included with skinr and skinr_ui modules, and has its own tests.
Committing so we can proceed with the next step.
Comment #32
moonray CreditAttribution: moonray commentedUh, and the patch.
Comment #33
moonray CreditAttribution: moonray commentedI updated and tweaked the additional changes from #23 in a new patch.
Committed.
If you have some input on the above 2 patches which warrant additional code, feel free to re-open this ticket.