I know the topic of default skins has come up before #549096: Default Skins, but I would like to propose this for D7.
A few things have changed that make this a stronger idea for Drupal 7:
- Region styles -- if you want to use Skinr to do region styling that's fundamental to the design of the theme, then having that not working out the box is a poor user experience
- Layout -- again, especially since Skinr could be used for sidebar & content region widths
- More elements are now regions/blocks, like highlight, footer, etc. Themers have historically been able to control the out-of-the-box output of these because they're printed directly in the theme, but now they are normal blocks, so a skin has to be manually applied.
Also it would be very handy to set a default skin for unique elements, like primary links -- eg. assign a dropdown menu style for a menu_block in the 'navigation' region. If there's basically only one skin in a theme that works for a certain region/block, why not just be able to set it automatically?
A cascading approach, where styles apply from the more general to the most specific, would allow for the widest range of use cases.
I'd propose a syntax like the following, either in the .info file or perhaps a separate defaults file:
skinr[element][block][default][myskin_name][option] = 1
skinr[element][block__user][default][myskin_name][option] = 2(apply myskin_name option #1 for all blocks, but then option #2 for user module blocks)
The [element] and [default] keys would delineate between where it should be applied vs what skin should be applied.
Here's another example with stacked restrictions:
skinr[element][region__sidebar_second][block__menu][default][skin_system_name][option] = 2
(apply skin_system_name option #2 for all menu blocks in the sidebar second region)
Default skins could be displayed in the admin UI like other modules such as Views or Imagecache do now, where there is a "default" listed which is shown as "overridden" if it has been edited, and could even be reset to default from here.
This feature could also make it possible to address two other common concerns with Skinr:
- Managing style settings in code
- More granular Skinr permissions
For #1, this would make it possible (if you wanted to get this granular) to set all skins throughout a site in code. This would address the complaint that all configuration lives in the database rather than in version control.
For #2, it would then be possible to create a Skinr permission that allows changing styles, but not overriding defaults. So a user with just this permission could only change skins that had already been overridden (or did not have a default?), but would not have permission to edit a skin set to the default. This way developers could control which skins could be administered by the client or some other level of user without giving full Skinr permissions.
Comments
Comment #1
ChrisBryant commentedI discussed this a bit with Stephthegeek in IRC and mentioned that we could possibly use/rely on the Features module for handling default settings in code and reverting overridden settings, etc.
I'm not sure we could properly (with good usability) cover the requested use cases entirely with Features, but it could get us pretty far along the way.
Comment #2
moonray commentedI'm not very happy about the idea of putting this data in the .info file. The info file should only contain the possible options. Having default values on elements is very site specific...
If we were to have a defaults, I would prefer them in something like THEMENAME.skinr_default.inc (like views does).
I'll have to look at features more in-depth to see what it allows us to do.
Comment #3
jacineI'm really against this because it screams install profile to me. On top of that, it's a pretty significant change and would add all sorts of complexity and overhead. We have enough issues maintaining what we already have.
Anyway, since we are in the process of moving to .inc files, this really can't be properly evaluated until that's done. After that is complete, we can discuss whether or not this makes sense doing this in the next version.
Comment #4
moonray commentedUpdating to a more descriptive title.
Comment #5
moonray commentedThis could probably made to work if we use some form of CTools import/export API. See #744706: Add Features support.
Comment #6
moonray commentedThis is now in Skinr 7.x-2.x due to the above issue.