I've created a patch that allows you to use cross-entity dependees using the Inline Entity form or Field collection module. It's probably far from perfect, but it does (at least for me) the job!

The dependee collection process is quite heavy, so it might take a while to load your field conditions page for the first time (all lists are cached).

Please note this patch depends on the patch in #1464950-67: Support for multiple "Field collection" and "Multifield" fields, I've also included some t() changes from the patch in #1464950-42: Support for multiple "Field collection" and "Multifield" fields (all credit goes to joel_osc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Matthijs’s picture

Matthijs’s picture

Here's an updated version of the patch, the previous version caused some issues in the admin interface...

I also changed (and fixed) the way conditions are grouped together, you now get a clean table with an AND grouping the other groups if there is more than one group.

Matthijs’s picture

Another update due to a minor issue with the field trail...

Matthijs’s picture

Here's another update that fixes the support of optional Field Collection items.

Matthijs’s picture

Updated patch attached, I've fixed 2 minor issues:

  • Entity select lists don't support conditions on their entity fields.
  • Colspan on the admin table.
ziroow’s picture

Category: feature » bug
FileSize
91.55 KB

Hi, I'm trying to apply the patch, but I get 10 hunks failed. There are errors in the screenshot. What am I doing wrong?

Thank you in advance for your reply.

Matthijs’s picture

Did you apply #1464950-67: Support for multiple "Field collection" and "Multifield" fields before applying this one?

I'm on Windows, so I cannot test "patch -p1" but "git apply" with the latest patch works fine on a clean module checkout.

ziroow’s picture

Yes I apply patch #1464950-67 before applying this one.

I'm not familiar with git, but I urgently need to use the functionality of the module on the new site(( Can I download the patched module or as I apply the patch via git?

Matthijs’s picture

Category: bug » feature

I've uploaded the patched module here: http://www.sendspace.com/file/vq5rg7

ziroow’s picture

Category: feature » bug

Thank you very much!

Cross entity dependes earned))

But if dependent choose a field of type "fild_collection", it is not hidden when creating/editing a node.

ziroow’s picture

Category: bug » feature
Status: Needs review » Fixed

I managed to solve my problem thanks to this patch conditional_fields-fix_for_collections_11.patch

Thanks for the help!

Matthijs’s picture

Status: Fixed » Needs review

No problem! But please don't mark this issue as fixed, because the patch still need reviewing...

Matthijs’s picture

Fixed faulty advanced static pattern.

Matthijs’s picture

Patch updated, I fixed the undefined index issues in conditional_fields_evaluate_dependencies().

Matthijs’s picture

Another "undefined index" update.

Matthijs’s picture

kyletaylored’s picture

After applying #1464950: Support for multiple "Field collection" and "Multifield" fields, I get.

$ patch -p1 < conditional_fields-cross-entity-dependees-1995516-16.patch
patching file conditional_fields.css
patching file conditional_fields.module
Hunk #28 FAILED at 2174.
1 out of 28 hunks FAILED -- saving rejects to file conditional_fields.module.rej
patching file includes/conditional_fields.admin.inc
Matthijs’s picture

Did you apply the correct patch (the one in comment #62)? Please try "git apply" instead of "patch -p1", that works for me...

kyletaylored’s picture

git apply doesn't work for me, patch -p1 always works (This is the general workaround). I didn't use the patch in comment #62, and when I did use it instead of #81, I received even more errors.

$ patch -p1 < conditional_fields-cross-entity-dependees-1995516-16.patch
patching file conditional_fields.css
patching file conditional_fields.module
Hunk #5 FAILED at 453.
Hunk #6 FAILED at 491.
Hunk #7 FAILED at 515.
Hunk #8 FAILED at 523.
Hunk #9 FAILED at 542.
Hunk #10 FAILED at 551.
Hunk #11 FAILED at 564.
Hunk #12 FAILED at 590.
Hunk #13 FAILED at 600.
Hunk #14 FAILED at 623.
Hunk #15 FAILED at 637.
11 out of 28 hunks FAILED -- saving rejects to file conditional_fields.module.rej
patching file includes/conditional_fields.admin.inc

The most recent RTBC patch to be tested is #81. Shouldn't this reflect what's in there first since it came in about 2 months prior to your patch?

sifuhall’s picture

I have the same problem.

Hunk #5 FAILED at 453.
Hunk #6 FAILED at 491.
Hunk #7 FAILED at 515.
Hunk #8 FAILED at 523.
Hunk #9 FAILED at 542.
Hunk #10 FAILED at 551.
Hunk #11 FAILED at 564.
Hunk #12 FAILED at 590.
Hunk #13 FAILED at 600.
Hunk #14 FAILED at 623.
Hunk #15 FAILED at 637.
11 out of 28 hunks FAILED -- saving rejects to file conditional_fields.module.rej
patching file includes/conditional_fields.admin.inc
Matthijs’s picture

Hi,

I used the patch in #62 because it was already applied in the project I was working on. I'll check the failed hunks and create a new patch soon.

Matthijs

jonhattan’s picture

I updated the patch in #1464950: Support for multiple "Field collection" and "Multifield" fields with minor fixes (comment #101) and also rerolled #16 here.

In this patch I've excluded the t() changes, since they're unrelated. Also, whitespaces introduced within #1464950 are fixed there.

SocialNicheGuru’s picture

#22 doesn't apply to the dev version of conditional fields

git apply conditional_fields-cross-entity-dependees-1995516-22.patch
error: patch failed: conditional_fields.module:454
error: conditional_fields.module: patch does not apply

patch -p1 < conditional_fields-cross-entity-dependees-1995516-22.patch
patching file conditional_fields.css
patching file conditional_fields.module
Hunk #3 FAILED at 461.
Hunk #4 succeeded at 733 (offset 9 lines).
Hunk #5 succeeded at 902 (offset 9 lines).
Hunk #6 succeeded at 949 (offset 9 lines).
Hunk #7 succeeded at 970 (offset 9 lines).
Hunk #8 FAILED at 1067.
Hunk #9 succeeded at 1320 (offset 8 lines).
Hunk #10 succeeded at 1428 (offset 8 lines).
Hunk #11 succeeded at 1518 (offset 8 lines).
Hunk #12 succeeded at 1544 (offset 8 lines).
Hunk #13 succeeded at 2129 with fuzz 2 (offset -9 lines).
2 out of 13 hunks FAILED -- saving rejects to file conditional_fields.module.rej
patching file includes/conditional_fields.admin.inc

jonhattan’s picture

SocialNicheGuru’s picture

it does apply cleanly if done in that order.
I also had a conflict with another patch too.
Sorry to clutter the queue!

artis.bajars’s picture

#22 works well as long as the field collection is limited to a single value. However, for multivalued field collections, as soon as you click "Add another item" the configured dependencies fail and the states are not applied for any of the instances.

SocialNicheGuru’s picture

Edit: can this patch be rerolled against: https://drupal.org/comment/8419673#comment-8419673?