Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As a themer i would like to have the option of exporting the styles i have created with the Styles UI into a feature.
Comment | File | Size | Author |
---|---|---|---|
#5 | 1189040-styles-features-integration-5.patch | 5.79 KB | fabsor |
#4 | 1189040-styles-features-integration-4.patch | 1.03 KB | fabsor |
#1 | styles-features-integration.patch | 6.05 KB | fabsor |
Comments
Comment #1
fabsor CreditAttribution: fabsor commentedHere 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.
Comment #2
skruf CreditAttribution: skruf commentedThanks for the quick response fabsor. Seems to work well. I'll update if we find any issues.
Comment #3
roborn CreditAttribution: roborn commentedAll good here. :)
Comment #4
fabsor CreditAttribution: fabsor commentedI experienced issues when using the new media 2.x branch together with file entity. This updated patch seems to solve the problems.
Comment #5
fabsor CreditAttribution: fabsor commentedThe patch above didn't contain everything. Here is an updated version.
Comment #6
mlncn CreditAttribution: mlncn commentedLooks good.
Comment #7
aaron CreditAttribution: aaron commentedawesome, thanks! got that committed now.
Comment #8
jwilson3This 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...