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.
The issue #368143: Features compatibility gave us features compatibility for 6.x. This is a feature request to have the same functionality ported to 7.x.
Comments
Comment #1
Shadlington CreditAttribution: Shadlington commentedSubbing
Comment #2
fearlsgroove CreditAttribution: fearlsgroove commentedsub
Comment #3
willvincent CreditAttribution: willvincent commentedThis patch seems to work for me. Though it's limited to conditional fields on nodes in it's present state.
At least this should get the ball rolling, I don't think it should be too much additional work to make this work for any entity.
I've attached an older p0 format patch, since drush make isn't able to use the newer p1 format patches that I'm aware of, as well as a newer p1 version.
I look forward to feedback.
Comment #4
willvincent CreditAttribution: willvincent commentedOops. paths were wrong, and preventing normal patch application.
I've removed the preceeding directory and re-attached the patch in both p0 and p1 versions here.
Comment #5
willvincent CreditAttribution: willvincent commentedOne hiccup I'm seeing currently, If you're including conditional fields with a content type feature, for fields that don't exist already when you go to enable to feature, it'll fail horribly.
I'm looking into how best to control the order the conditional fields include file gets called in, so that it can (hopefully) be processed last.
EDIT: The workaround seems to be to put conditional field settings into their own feature and ensure that feature depends on the other features that provide the fields it requires. This feels a little messy to me, really wish features had a weight for processing include files.
Comment #6
Shadlington CreditAttribution: Shadlington commentedRaise an issue for that weighting in the features queue?
Comment #7
willvincent CreditAttribution: willvincent commentedI have posted an issue #1216224: Provide documentation about feature component processing order in the features queue for it, yes.
Comment #8
AtomicTangerine CreditAttribution: AtomicTangerine commentedsub :)
Comment #9
DamienMcKennaCould it maybe not validate the data loaded via the features hooks?
Also, conditional_fields_features_export_options() has some formatting issues, check to see if some tabs were accidentally added.
Comment #10
willvincent CreditAttribution: willvincent commentedYeah, I think a few tabs might have snuck in there..
Not sure what you mean about not validating the data. Can you explain that a bit more?
Comment #11
fearlsgroove CreditAttribution: fearlsgroove commentedAttached patch works for any entity:bundle combination. It doesn't address the weighting issue. There are two workarounds for that:
The real fix should be weighting or dependency checking in features, so I don't think it makes much sense to address it here.
The only thing not as good about this patch compared to the previous patch is that it doesn't make any attempt to make the features options look good - it just uses the raw entity_type:bundle strings.
Comment #12
willvincent CreditAttribution: willvincent commentedOption #2 won't work with a distribution or install profile, which is really the main issue.
I don't think it would take much to make the patch in #11 display nicer option names.. I'll take a look at that, off the top of my head, I think it'll just be one or two more lines of code.
Comment #13
willvincent CreditAttribution: willvincent commentedHere's a new version of the patch from #11 with nicer labels for the conditional field entity bundles.
The format is bundle label (bundle type)
Example:
Page (node)
Attached both p0 & p1 patch formats. These should both apply to the most recent d7 git branch, as well as the most recent 7.x dev snapshot.
Issue with feature weighting remains as before.
Comment #14
likewhoa CreditAttribution: likewhoa commentedi am monitoring this thread
Comment #15
wiifmsubscribe
Comment #16
fearlsgroove CreditAttribution: fearlsgroove commentedRe-roll of #13 against current -dev to fix some hunking and missing newline at the end of the module file. This is working well for me, and since this is just a re-roll I'll go ahead and RTBC
Comment #17
peterpoe CreditAttribution: peterpoe commentedconditional_fields.features.inc was in the wrong folder, but otherwise it seems to work fine, so I just committed! Thanks everybody, willvincent in particular.
Comment #18
willvincent CreditAttribution: willvincent commentedAwesome. And I appreciate the nod. ;)