As a themer i would like to have the option of exporting the styles i have created with the Styles UI into a feature.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fabsor’s picture

Status: Active » Needs review
FileSize
6.05 KB

Here is a patch for that.

This patch creates a feature that defines the styles in hook_default_styles and then writes an alter function to set the desired preset on in hook_default_presets_alter. It seems that it needs to be done that way since the presets for all styles is set in hook_default_presets(). This also makes the code a bit of a hack, but the win is that the patch is completely non-intrusive, and does no API changes at all.

I think we should have a look at exporting styles with CTools in upcoming versions. Doing that right now would break the API badly however, so I don't think it is appropriate for this release.

skruf’s picture

Thanks for the quick response fabsor. Seems to work well. I'll update if we find any issues.

roborn’s picture

Status: Needs review » Reviewed & tested by the community

All good here. :)

fabsor’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.03 KB

I experienced issues when using the new media 2.x branch together with file entity. This updated patch seems to solve the problems.

fabsor’s picture

The patch above didn't contain everything. Here is an updated version.

mlncn’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

aaron’s picture

Status: Reviewed & tested by the community » Fixed

awesome, thanks! got that committed now.

jwilson3’s picture

This is great!!! However there is one error thats happening now, because of this code inclusion: #1283280: Undefined variable: module in styles_style_features_export, maybe the original patch creator from this thread could have a look...

Status: Fixed » Closed (fixed)

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