With the growing use of sub-themes, an important use case for Skinr styles is being able to inherit styles from parent/base themes. Attached is a patch that adds this feature.
If the user adds 'skinr[inherit_styles] = true' to their sub-theme's .info file, then it will inherit the skinr styles from all of its parent themes. If the statement is not added (default condition) or is set to 'false' then no styles are inherited and only the sub-theme's styles, if any, are used.
If the sub-theme has a Skinr style with the same name as a parent theme's style, then it will override the parent style.
Hope this proves useful, and feel free to modify the code and/or setting as needed.
Comments
Comment #1
jacineChris this is awesome! Thank you so much.
I'll check it out ASAP :)
Comment #2
sociotech commentedJacine,
Thank you guys for an amazing module!
Comment #3
jacineHey, testing this out and it doesn't work ATM if you:
a - Have a base theme (enabled & disabled) without skins in it. You get an easily fixed array merge error, but also no skins even though the subtheme contains them.
b - Don't have a subtheme at all, but just a regular theme w/skins, this patch wipes them out.
I didn't get a chance to add
skinr[inherit_styles] = truebefore running into this.Comment #4
sociotech commentedJacine,
Here's a new patch to replace the original one (it should be run against Skinr without the previous patch).
It contains a substantial rewrite of the skinr_inherited_styles() function, mostly in order to eliminate a call-time reference passing error I introduced with my previous patch. Hopefully it also fixes your errors.
Unfortunately, I wasn't able to reproduce your errors locally with my original patch, so the fact that I'm not seeing them with this new patch doesn't make me confident that I've addressed your issues. Can you try this new patch and then let me know if you're still getting those errors?
Thanks so much for reviewing and testing this patch!
Comment #5
jacineOk, progress - it works - but still having some small issues when subtheming with
skinr[inherit_skins] = true, whether skins actually exist in the subtheme.info or not:#2 is easily solved by adding
(array)to line 380#1 is over my head.
PS - I renamed "styles" to "skins" for consistency, and that's not the problem.
Comment #6
jacineHey Chris!
Bala was able to figure out what the scalar array issue was. It actually had to do with the
skinr[inherit_styles]line in the .info file. It's fixed, and your patch has been committed to head!Thanks so much for the patch ;)
Comment #7
sociotech commentedJacine,
Sweet!
I'm puzzled that I wasn't able to replicate the error on my system, but grateful that Bala was able to figure it out.
Thanks very much for helping get this patch in!
Comment #8
sociotech commentedJacine,
Minor point, but the readme.txt in the latest dev release says that the setting to enable inheritance is:
skinr[inherit_styles] = true
But unless I'm mistaken, it appears that it is actually:
skinr[options][inherit_skins] = true
Not a big deal, but wouldn't want to confuse folks.
Thanks!
Comment #9
jacinewhoops! Thanks Chris, it's fixed :)