Over in #1161314: Add basic Field Group support for ANDing conditions, we have a patch that adds initial support for field_group. However, it calls field_group_info_groups() to get a list of field_group elements, and thus has to be wrapped in module_exists(). We'd like to refactor that to make it a hook that could be implemented in field_group, since that'd be much more maintainable.

Similarly, in that same issue, we're working on allowing conditional_fields settings for a field_group element to apply instead to the fields that it contains. It may be worthwhile to introduce another hook at that point to delegate how to determine which fields are contained within a group field. Again, the idea is just to keep the implementation-specific logic where it belongs.

Comments

ergonlogic created an issue. See original summary.

ergonlogic’s picture

Patches will be forthcoming, as the hooks are introduced in conditional_fields.

ergonlogic’s picture

Status: Active » Needs review
StatusFileSize
new641 bytes

hook_conditional_fields() was introduced in this patch in #1161314: Add basic Field Group support for ANDing conditions. The patch here implements that hook, to make Conditional Fields aware of Field Group elements.

ergonlogic’s picture

StatusFileSize
new909 bytes

The attached patch adds an implementation of hook_conditional_fields_children(), introduced in this patch from #1161314: Add basic Field Group support for ANDing conditions. This allows Conditional Fields to propagate its settings from the Field Group to the fields that it contains.

ergonlogic’s picture

StatusFileSize
new952 bytes

Minor update to handle calls to the implementation of hook_conditional_fields_children() where the field being queried isn't a field group.

ergonlogic’s picture

StatusFileSize
new993 bytes

I updated how hook_conditional_fields_children() gets called to keep internal logic/state from leaking.

kris77’s picture

This look fine for me.

Thanks a lot @ergonlogic, your patch works fine.

colan’s picture

@Kris77: Care to RTBC this then?

kris77’s picture

Status: Needs review » Reviewed & tested by the community
liliplanet’s picture

Omg, that is fabulous, thank you for the dedication that went into this, world perfectly 😁

nils.destoop’s picture

Status: Reviewed & tested by the community » Fixed

Thx for the patch. I committed it to dev

Status: Fixed » Closed (fixed)

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