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

jacine’s picture

Chris this is awesome! Thank you so much.

I'll check it out ASAP :)

sociotech’s picture

Jacine,

Thank you guys for an amazing module!

jacine’s picture

Status: Needs review » Needs work

Hey, 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] = true before running into this.

sociotech’s picture

StatusFileSize
new1.79 KB

Jacine,

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!

jacine’s picture

Ok, 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:

  1. * warning: Cannot use a scalar value as an array in skinr.module on line 378.
  2. * warning: Invalid argument supplied for foreach() in skinr.module on line 380.

#2 is easily solved by adding (array) to line 380

, hopefully that's the right solution:

<?php  foreach ((array)$skin['features'] as $feature) { ?>

#1 is over my head.

PS - I renamed "styles" to "skins" for consistency, and that's not the problem.

jacine’s picture

Status: Needs work » Fixed

Hey 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 ;)

sociotech’s picture

Jacine,

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!

sociotech’s picture

Jacine,

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!

jacine’s picture

whoops! Thanks Chris, it's fixed :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.