Field groups are absent when viewed through an inline-entity-form.

It looks like this may be a recent regression as it was previously fixed in #2645570: Field Group not working on node edit inside inline entity form.

State of this issue

(September, 8th, 2019)

  • we have a patch (#3) with +10 worksforme
  • we have no code review
  • tests are missing (therefore NW)

Comments

chrisolof created an issue. See original summary.

nickdickinsonwilde’s picture

Issue tags: +Regression

Broken by #2878359: Field groups are not compatible with field layout - hate when there are no tests for a feature and hence it gets broken by other changes

rp7’s picture

Experiencing the same issue.

Debugging this I noticed #process callbacks don't seem to be called for Inline Entity Forms.

A snippet from \Drupal\Core\Form\FormBuilder::doBuildForm():

if (isset($element['#process']) && !$element['#processed']) {
  foreach ($element['#process'] as $callback) {
    $complete_form = &$form_state->getCompleteForm();
    $element = call_user_func_array($form_state->prepareCallback($callback), [&$element, &$form_state, &$complete_form]);
  }
  $element['#processed'] = TRUE;
}

The field_group_form_process callback is added while the above process callbacks are already being processed, and thus is never called.

The patch attached does fix my issue, but I'm not familiar with Field Group & Inline Entity Form all too well - I would suggest someone more experienced to look at this.

scottsawyer’s picture

So far it is working for me, at least resolved the immediate issue of the ief not rendering the field group ( and worse, totally mangling my form ). Great job.

superlolo95’s picture

+1 for #3

esolitos’s picture

While patch #3 works fine, I'm not sure that's the best approach.

esolitos’s picture

Status: Active » Needs review
hanness’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Thanks, #3 works for me as well. I'm no coder = cannot review.

Setting to NW as tests are missing as mentioned in #2.

jienckebd’s picture

#3 worked for me too.

Not sure why it's not the best approach, but it doesn't seem too harmful. I'm happy with anything that makes IEF work for fringe cases.

phernand42’s picture

#3 worked for me too

attheshow’s picture

#3 is working for us.

anybody’s picture

jagermonster’s picture

#3 patch also seems to fix the issue with inline entity forms after updating this from beta1 to rc1

alison’s picture

I've got this issue, too, and #3 fixed it -- don't know enough to comment on the concerns expressed in the thread, but very happy with the outcome so far! Thank you! (And thank you, @Anybody, for mentioning it on the referenced paragraphs issue thread!)

hanness’s picture

Issue summary: View changes

added current state to the summary:

  • we have a patch (#3) with +10 worksforme
  • we have no code review
  • tests are missing (therefore NW)
swentel’s picture

Status: Needs work » Needs review

It seems like the patches fixes the issue for some people. If they can reconfirm, or someone else can confirm as well, I will just commit the patch and open an issue for an explicit test as a task.

swentel’s picture

Assigned: Unassigned » nils.destoop
Status: Needs review » Reviewed & tested by the community

Also, fwiw, I just tested this myself, and with the patch the groups are indeed rendered.

So setting RTBC, will assign it to zuuperman first to get his opinion on it as well, but I feel like it's fine.

dww’s picture

FWIW, +1 to #3 being RTBC. I've been using it for months without trouble. The rationale in #3 makes sense, the patch is extremely small. I don't know *that* much about the internals of IEF, but I've been bitten numerous times by the normal form workflows not doing what you expect, so instead of relying on #process callbacks, directly calling what we need makes sense to me.

Thanks,
-Derek

nils.destoop’s picture

Tested and debugged. The patch is ok. The inline_entity_form_entity_form_alter is beïng called in the processing part of the form, so the #process is never executed.

The patch fixes it, but introduces the risk that someone else is also implementing the inline_entity_form_entity_form_alter hook. That module needs to come before fieldgroup.

  • zuuperman committed 6c468e2 on 8.x-3.x authored by rp7
    Issue #2986704 by rp7, esolitos, swentel, chrisolof, hanness,...
nils.destoop’s picture

Status: Reviewed & tested by the community » Fixed

Committed the patch and marking as fixed. Thx for the patch

Status: Fixed » Closed (fixed)

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

dcrespin’s picture

Hello, since the rc2 update, this patch is no longer compatible and I got the same problem as before.
I had to rollback to the rc1 version.

anruether’s picture

@dcrespin : The committed code is still in, could you open a new issue with steps to reproduce?