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.
So is there any plans of adding support for features or did i miss something ?
Comments
Comment #1
jezza CreditAttribution: jezza commentedI'm interested in this as well. Thoughts anyone?
Comment #2
berenddeboer CreditAttribution: berenddeboer commentedNot yet. Patches welcome :-)
Comment #3
grasmash CreditAttribution: grasmash commentedThe best way to accomplish this would be to integrate block_class with the boxes module, which is compatible with features.
Comment #4
rudiedirkx CreditAttribution: rudiedirkx commentedThe best way is to add features support in this module. No need for another (boxes) module. Addding features support can't be that hard... Block Class has its own db table, so it can make clean exports.
Comment #5
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedTogether with rudiedirkx we've created the features implementation. You just need to drop this file into your block class module folder and it works.
Rudie wants to explore if he can load the classes from code instead of from code. So he might improve on this later.
Comment #6
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedComment #7
jeffschulerAwesome. I had to fix the patch a bit, but I've tried exporting and reverting and it's working for me.
Thanks Johnny vd Laar & rudiedirkx!
The patch in #5 wasn't applying (error: malformed patch) because it's missing a newline at the end of the file. Also, the patch should be made relative to the module directory, not your site root.
I also added a @file description comment to block_class.features.inc (to follow docs conventions,) but haven't changed any code.
Comment #8
rudiedirkx CreditAttribution: rudiedirkx commentedExcellent @jeffschuler!
Any reviewers? (I don't think I'm supposed to review my own handiwork.)
Comment #9
stBorchertQuick review:
This needs to move into block_class.module.
Why default theme only? Its not possible to export classes for blocks in admin themes with this setting.
Line-break before "SELECT".
Why not db_select?
Its better than building the query string manually.
Unused.
Comment #10
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedI think we can drop the filter on just the default theme.
Should we allow all themes or just the default theme and the admin theme?
Comment #11
stBorchertHm, it would be cool if one could export block classes for each theme individually. So you can export settings for seven and rubik for example, but do not include settings for other (enabled) themes.
Comment #12
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedNodeblock doesn't store it's settings per theme, just per block so I don't think this is possible with the current db schema.
Comment #13
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedAttached is a new patch with the advice of stBorchert included.
Comment #14
Patrick R. CreditAttribution: Patrick R. commentedPatch from #13 doesn't work for me as the actual block classes weren't exported. I'd recommend the following changes:
Thoughts ?
Comment #15
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedYes you are right. Attached is a new (better tested) patch.
Comment #16
aschiwi CreditAttribution: aschiwi commented@Johnny vd Laar
great patch in #15, works good to export and deploy. activated feature with a block and a block class on new site, class was there as expected.
Comment #17
Patrick R. CreditAttribution: Patrick R. commentedExport itself now is working fine but when (re-)creating a feature, the component listing for "Block class" displays all available block class settings, even those that are already exported by other features.
Comment #18
rudiedirkx CreditAttribution: rudiedirkx commented#17 I saw that today too. I think that should be Features' responsibility though. Only Features knows which features are enabled and which components they contain. Features also keeps a cache where that should be stored. I don't know why it doesn't...
Comment #19
rudiedirkx CreditAttribution: rudiedirkx commentedNope. It's block_class' fault.
hook_block_class_features_default_class
shouldn't return a numeric array.Comment #20
rudiedirkx CreditAttribution: rudiedirkx commentedI fixed it in this patch. Was easy enough. Doesn't invalidate (but does override!) existing features with block classes. You have to recreate your existing features to have them not overridden.
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commentedPatch from #20 unfortunately does not work.
Following problem occurs:
"patching file block_class.features.inc
patching file block_class.module
patch unexpectedly ends in middle of line
patch: **** malformed patch at line 101:"
However, patch #15 works fine and without any problems.
Comment #22
rudiedirkx CreditAttribution: rudiedirkx commented#15 isn't good enough. It doesn't use the features defaults hook correctly (like a true Features user would expect). The patch in #20 does. I'll recreate it tomorrow.
Comment #23
aschiwi CreditAttribution: aschiwi commented@rudiedirkx
Thanks, that's great. When you post it can you mention which version you created the patch against? Current stable or dev.
Comment #24
rudiedirkx CreditAttribution: rudiedirkx commentedRerolled it. Against dev (292601fc0adbcbdd3175a2316047f878259e65d9).
Let's include it already. 13 months is long enough.
PS. I think it's the exact same patch as #20... Don't know why it wouldn't apply.
Comment #25
aschiwi CreditAttribution: aschiwi commentedpatch in #24 applies and works as advertised. Thanks for your work rudiedirkx. One more tester and then set to rtbc?
Comment #26
SuleymanK CreditAttribution: SuleymanK commentedHello guys nice work,
is it possible to merge this patch with the "features extra" module? It would be nice to work with an unique id to get the settings of a block.
Comment #27
aschiwi CreditAttribution: aschiwi commented@komochti: could you please create a new feature request issue and report here just how you find the last patch working?
Comment #28
rudiedirkx CreditAttribution: rudiedirkx commentedMerge with what in the Features Extra module? And why? Would that make the Features Extra module a requirement? That would be very silly. Link?
Blocks already have unique id's: module + delta. UUID's aren't relevant, are they?
Comment #29
aschiwi CreditAttribution: aschiwi commented@rudiedirkx: I saw what he means. With custom blocks you only get the block id which can be different across several sites when exporting blocks with Features. Then someone exports a block class for say block 4 and it gets applied to a different block on my site because on my site block 4 is a different one. Features Extra uses a machine name to export blocks, so I'm guessing that's what he's asking (but should be in a different issue). Unfortunately UUIDs, at least from UUID module, only work for entities. From what I saw today there's no existing solution to this problem.
Comment #30
rudiedirkx CreditAttribution: rudiedirkx commented@aschiwi The features patch we (Johhny and I) made works with machine names too: module + delta. Custom blocks are content, so they have a 'contentual' delta. (Not the `bid` but some serial int.)
Since most - by far- blocks are blocks made by other modules (which means meaningful delta's) I don't think it's a problem... It'd be nice if it worked ofcourse, but it'd be stupid to require an additional module (Features Extra) to create a tiny feature (block class features) in a module (block class) that doesn't need that additional module 95% of the cases (good delta's).
How would it work, though? I'm curious. What does Features Extra add? A table with UUIDs? It might be possible to make it an 'optional dependency'. (I know that's not a thing.)
Comment #31
rudiedirkx CreditAttribution: rudiedirkx commented@aschiwi I think block_class features and Features extra would play well together. It requires tiny changes in this patch and then it'd check
module_exists('features_extra')
.I'm not making the tiny changes though =) I'm very content with the current state.
Comment #32
aschiwi CreditAttribution: aschiwi commented@rudiedirkx yeah let somebody create a new issue for that and set this to rtbc to get it in :) thanks for your work everyone!
Comment #33
stBorchertNew patch with integration of Features Extra.. If there is a machine_name for a block it will be used. Otherwise the blocks delta is used.
Unfortunately this leads to a bug in Features Extra itself. Patch is here: #1762678: Trying to get property of non-object ... fe_block.module line 443.
Comment #34
stBorchertNever mind, the patch makes false assumptions (I thought $delta would match the block id).
Needs complete rethinking and rework ...
Comment #35
yannickoo$delta isn't enough. You need a module - delta combination but I would force the user the enter a machine name.
Comment #36
aschiwi CreditAttribution: aschiwi commentedalright people let's get the patch from #24 in. new issue for machine name integration please.
Comment #37
berenddeboer CreditAttribution: berenddeboer commentedCommitted #24, thanks guys!
Comment #38
Elijah LynnGreat news!
Here is the commit for reference - http://drupal.org/commitlog/commit/5828/f34e5a1786a6887edaf5789c032ff1aa...
Comment #39
aschiwi CreditAttribution: aschiwi commentedthanks everyone!
Comment #40
zhangx1a0 CreditAttribution: zhangx1a0 commentedThanks!
But is this working for custom blocks (boxes) created from admin UI?(I have some content boxes and currently I export/import them by Feature Extra module. Of course block class is missing after import.)
OK - I've tested it and it does not work for boxes. Reason was explained by #29.
Comment #41
Mattias Holmqvist CreditAttribution: Mattias Holmqvist commentedNice patch! Works as expected.
Comment #42
rudiedirkx CreditAttribution: rudiedirkx commented2.1 doesn't have it, and I don't like fe_block, so here's the same method for 2.1.
Comment #43
jeffschulerAh, the functionality added in this issue was removed from block_class, and provided via the features_extra module. See #2110593: Reintroduce Features integration in 2.x branch.