I have a module that takes my entity's fields and adds them to it's own form using `hook_field_attach_form()`.

Can anyone shed some light on whether or not it would be possible to support `hook_field_attach_form()` for field dependencies?

I gave it a shot, and was able to hide fields, but not show them with behaviors.

The modules I'm attempting to use with this are registration and commerce_registration.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

arosboro’s picture

Title: Support for hook_field_attach_form() » support for markup fields
FileSize
634 bytes

I did some debugging and discovered that the issue stems from the entity and bundle information being located at delta 0 of the field rather than in the field root level.

This patch allows markup fields to be evaluated using the entity and bundle information provided at delta 0 of the field.

See #1787046: Setting #field_parents for the conditional fields module for a patch to set the correct value for #field_parents in the field if using Commerce Registration.

arosboro’s picture

Status: Active » Needs review

Patch complete. Setting status to "needs review";

arosboro’s picture

Component: Code » Compatibility w/ other modules

Changing component to "Compatibility w/ other modules" since this applies to the Markup module

jason.fisher’s picture

This patch along with the patch from comment #42 http://drupal.org/files/conditional_fields_fixed_multiple_field_collecti... at http://drupal.org/node/1464950 has allowed conditional fields to work with Commerce Registration and Field Collections here.

akalata’s picture

Status: Needs review » Reviewed & tested by the community

#1 works for me, thanks!

akalata’s picture

Issue summary: View changes

Updated issue summary.

markabur’s picture

Issue summary: View changes

#1 works for me too, to show/hide Markup fields.

kyoder’s picture

Worked for me and patch applied cleanly against 7.x-3.0-alpha1+12-dev.

SocialNicheGuru’s picture

Status: Reviewed & tested by the community » Needs work

When I apply this patch, field_collections are no longer effected by a dependee.

kyoder’s picture

Field collection doesn't work with conditional fields with or without this patch.
The issue queue has several field collection related posts such as this one https://www.drupal.org/project/conditional_fields/issues/1464950