Closed (fixed)
Project:
Skinr
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Nov 2010 at 23:36 UTC
Updated:
11 Feb 2011 at 19:40 UTC
Jump to comment: Most recent file
Just noting this here because we discussed doing something to make it easier for contrib themes working with base and sub themes. It may not even be something we'll need to do, but I don't want to forget.
Marking it postponed for now, since #956994: Write load and parse code for Skinr include files in PHP format will have to happen first.
| Comment | File | Size | Author |
|---|---|---|---|
| #28 | skinr-HEAD.theme-status.28.patch | 29.64 KB | sun |
| #24 | skinr-HEAD.theme-status.24.patch | 28.88 KB | sun |
| #22 | patch_commit_536b71db3e5d.patch | 19.54 KB | moonray |
| #19 | skinr-HEAD.theme-status.19.patch | 12.91 KB | sun |
| #16 | skinr-HEAD.theme-status.16.patch | 9.06 KB | sun |
Comments
Comment #1
moonray commentedWe original thought this whole thing through, but just having gone through code again today I realize that there's no way currently to easily enable skins from a disabled theme (usually the parent theme is disabled).
The loading code in #956994: Write load and parse code for Skinr include files in PHP format includes the function skinr_get_directories() which determines the skin plugins that could get loaded. It will never include skin plugins for disabled themes, however.
We discussed using hook_skinr_skin_info_alter() to pull in the skins we want from a parent theme. We would need a helper function that does the following:
Some notes:
I'm not too happy about having to manually go back and load new plugin files. Perhaps there's a way to load plugins, but not invoke the hooks for them in the first pass of loading plugins.
Comments on this approach are appreciated (and needed).
Comment #2
Jeff Burnz commentedFrom this I assume therefor if the base theme in enabled and I do this...
...then the skin should be available to the the subtheme?
This plugin/skin is in the base theme (adaptivetheme), and the subtheme is "at_opal". So far I have only been able to enable a skin that is actually in the theme - I assume some UI is to be built that allows me to enable any skin for any theme regardless of where it resides (a rule or configuration for the skin?).
Comment #3
jacine@Jeff Burnz, yes, that code you placed above, if done in an alter hook, per skin, should enable the skin by default for both the base and subtheme. In fact, the whole point of including this status property is to do that. As far as the UI goes, it will allow you to enable and disable any skins as long as the theme or module they reside in is enabled. In the case of sub themes, they should probably always enable the parent themes skins in code by default.
I am fully onboard with the approach @moonray described in #1. We discussed this at length, and for the record this is a very generic use case as far as Skinr is concerned so it absolutely needs to be addressed. Changing this back to active because it needs to be addressed and soon.
Also, I'm still not entirely positive how this will be done in code, so I would appreciate an example for documentation purposes.
Comment #4
coltraneOh my, I didn't know you can have an enabled subtheme and the parent theme is disabled. Is it not considered a bug that that is so? Could Skinr require that parent themes be enabled to use parent skins?
Comment #5
sunMost of this issue should actually be resolved through the patch we committed in #1015614: Subtheme inheritance
Comment #6
jacineIt's definitely a Drupal WTF, but there are some good reasons for it. It's nice that you don't have to deal with the base theme cluttering up the UI when working with blocks, for example.
Although, even if we force people to enable the base theme, we'd still need to handle the inheritance in order for the subtheme to be able to apply the base theme's skins, so Skinr knows to display them in the settings form and knows where to load the assets from.
Comment #7
jacineThis issue is about making a helper function to make this easier on people implementing skins under these circumstances though, not the inheritance itself.
Comment #8
sunUnfortunately, I don't see any actual bug report, feature request, problem statement, or summary in this issue. The OP references to the issue title or something, so it's entirely not clear what's actually the point of this issue. Can I haz some, plz? Thx! :)
Comment #9
jacineThis isn't a bug report or a feature request. We need to make it easy for base themes to automatically set themselves as "enabled" when one of their sub themes is in use, even if they are not enabled. That's what this issue is about. Nothing else. See comment #1.
If you know that can be done already, I'd be happy to see an example, as I asked for in #3.
Comment #10
Jeff Burnz commentedThis may or may not be related to this issue but I have run into a number of big problems in Core and other contrib modules when setting my base themes as
hidden = TRUE, this is an option we're supposed to be able to use but unfortunately is so borked for themes its just too much hassle (updates not working, Drush borking out badly etc etc). IMO Skinr should work even when this flag is set by a base theme. We should be able to completely hide base themes from end users, they should know nothing about them, unless they need to update them (not the issue here at all, just a rant...).Comment #11
sunDocumentation?
Comment #12
sunExpectation?
Comment #13
sunManual testing reveals that this works. Didn't run tests yet.
d'oh, exceeds 80 chars.
Comment #14
jacineCool. Gonna test it out :)
Comment #15
sunPasses tests for me.
Comment #16
sunCrap. Sorry.
Powered by Dreditor.
Comment #17
jacineOk, great. This is working great from manual testing for when the base theme knows the name of the subtheme and can include it.
But, now we are back to the helper function issue at hand. When the base theme does not know what the name of the subtheme is, how should that situation be handled. Obviously it's not a good idea to hack the base theme to add the name of the subtheme, so we thought we could handle this by implementing an
hook_skinr_skin_info_alter()in the subtheme and then provide a helper function for us themers to easily set the status for the skin in the base theme instead of needing to do all the looping ourselves.What are your thoughts on dealing with that use case?
Comment #18
jacineBTW, tests are failing for me with #16.
Comment #19
sunSlight adjustment in expectations.
Posting what I currently have, need some sleep. Previous patches contained a bogus change. But anyway, doesn't work yet.
Comment #20
sunHopefully, this revised title cuts it.
Comment #21
moonray commentedI still need to test with that patch that makes theme for tests load
, but here's something to start with:.After some testing, I found that skin plugins for disabled themes still get loaded. Disabling that is easy (test for $theme->status in skinr_implements()).Going to play with some code to load skin plugins on the hook_skinr_skin_info_alter().Comment #22
moonray commentedAttached patch builds on the previous one and adds api functions to enable and disable status. It adds the skinr_statuses table and removes the unused skinr_skinsets and skinr_skins tables. In addition it clears the stored skin_info and group_info cache whenever a theme is enabled or disabled to allow it to get refreshed.
The tests that sun wrote to test default status don't seem quite right; they require updates to the admin ui before they can work. I've added a function to test statuses, but it needs to be filled in (I'm still not sure on how to best test that, and it will also require an updated admin section). Temporarily the status of the current theme is displayed on admin/appearance/skinr/skins. See #984402: Add "details" link that shows preview of rendered skin widget and additional info about the admin ui changes.
This patch isn't quite there yet, but we're moving closer.
Comment #23
sun@moonray: Sorry, but that's the exact opposite of where we need to go; this logic does not belong into the skin processing code. Skin info handling has to be entirely decoupled from actual skin configuration. In other words: We have two APIs - one for registering and handling skin information (and only that), and second and separate one for loading/saving/applying skins ("skin configuration objects" if you will).
This particular issue is about getting the basic functionality working again, so those major database schema changes are too much. Rather belong into #1029058: [META ISSUE] Change skin configuration
I'm going to study your skinr_ui.admin.inc changes, as those seem to be the only that might make a difference to the second to latest patch.
Comment #24
sunAttached patch fixes this issue. Took me some hours to figure out the inheritance logic that allows a skin of a base theme to enable itself for the base theme, and therefore, also for all sub themes of that base theme.
If this was a painting, I'd call it 'artwork'.
Comment #25
moonray commentedThe ability to set the status of a skin (from plugin info, not an applied skin) has nothing to do with the ability to apply skins. I don't see how that needs to be separated.
Otherwise I tested the patch, and it seems to be working nicely. Can you explain, though, under which circumstances the base theme or sub theme status for a skin info gets
enabled or disabledinherited?Comment #26
sunThat's it, basically. There are two different and possible scenarios:
I understand. However, manual administration/management of skin statuses is a much larger topic, which we need to discuss in detail in a separate issue. Based on the current code, it seems like that information was previously stored in the database. Technically, this information rather belongs into a system variable — unless we are going to revamp the entire handling of skin information to be stored in the database, too (i.e., a
{skinr_info}table that'd be similar to the{system}table, tracking what exists, information and API versions, status, etc); but as of now, I don't really see a need for this yet, and TBH, if you ever dealt with bug reports and issues related to that {system} table behavior, you'd be similarly hesitant of forking/using that pattern. In the end, there's a lot to discuss with regard to manual configuration of skin statuses, and most likely also plenty of expectations (which might have changed?).Therefore, I'd like to focus on fixing the default status of skins for basethemes/subthemes via hook_skinr_skin_info() in this issue, which currently seems to block various base theme authors/maintainers from using Skinr.
EDIT: So it seems like all that is missing for this patch is a documentation tweak?
Comment #27
jacineThis is nice... Much better than a helper function. Awesome job @sun!
I didn't understand it from reading the patch, but the comment in #26 was a big help. I'll do the documentation tweak when I commit this, which I will do soon.
Comment #28
sunFixed one test failure and added some docs explaining this inheritance to .api.php.
Comment #29
jacineThank you! Committed :D