Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Shadlington’s picture

Subbing

fearlsgroove’s picture

sub

willvincent’s picture

This 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.

willvincent’s picture

Oops. 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.

willvincent’s picture

One 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.

Shadlington’s picture

Raise an issue for that weighting in the features queue?

willvincent’s picture

I have posted an issue #1216224: Provide documentation about feature component processing order in the features queue for it, yes.

AtomicTangerine’s picture

sub :)

DamienMcKenna’s picture

Could 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.

willvincent’s picture

Yeah, 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?

fearlsgroove’s picture

Attached patch works for any entity:bundle combination. It doesn't address the weighting issue. There are two workarounds for that:

  1. Put the field in a separate feature and depend on that feature
  2. Use drush, do a features-revert with --force, and use that to revert the fields section but NOT conditional fields, then do it again and revert the conditional fields

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.

willvincent’s picture

Option #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.

willvincent’s picture

Here'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.

likewhoa’s picture

i am monitoring this thread

wiifm’s picture

subscribe

fearlsgroove’s picture

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

Re-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

peterpoe’s picture

Status: Reviewed & tested by the community » Fixed

conditional_fields.features.inc was in the wrong folder, but otherwise it seems to work fine, so I just committed! Thanks everybody, willvincent in particular.

willvincent’s picture

Awesome. And I appreciate the nod. ;)

Status: Fixed » Closed (fixed)

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