Hi,
thanks for the continuos development of this module, its getting more and more usable.

I just found an issue when using Field Group inside a paragraph when editing. I don't have much to report, there is no error printed out. All the fields are there. But not in the groups. There is only a change in the ordering of the fields e.g. order form Manage form display is not respected on the edit form.

If I add a Field group to the Manage display of the paragraph it is working properly.

Steps to reproduce (tried even on fresh simplytest.me instance):

  • Enable Paragraphs demo module
  • Go to /admin/structure/paragraphs_type/image_text/form-display
  • Create new group and place one of the field in it.
  • Go to the "Welcome to the Paragraphs Demo module!" node created by Paragraphs demo module
  • Click on edit
  • Add new paragraph of type "Image + text"
  • There is no Group visible in the paragraph. :(

Proposed Resolution

Leverage the new core hook proposed in #2691723: Add a hook to alter entity form displays (requires core patch to be applied).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Petr Illek created an issue. See original summary.

Petr Illek’s picture

Issue summary: View changes
reekris’s picture

I'm experiencing the same issue using Drupal 8.0.1, Field Group 8.x-1.0-rc4 and Paragraphs 8.x-1.0-rc4. It could be a Paragraphs issue so maybe it would be a good idea to get the attention of the developers of that module? Is there a way to ping them from this issue, or do we have to create a duplicate issue in the Paragraphs issue queue?

nils.destoop’s picture

I investigated this issue, and we need a core patch for it. I created an issue, let's hope they want to add the hook, or fg will need to do hacky / ugly stuff to fix it.#2640056: Contrib modules can't alter the building of entity form displays

reekris’s picture

That's great, keeping my fingers crossed they merge your patch for the next Drupal release then!

sachbearbeiter’s picture

That's great, keeping my fingers crossed they merge your patch for the next Drupal release then!

Ditto ;)

chris_hall_hu_cheng’s picture

This one is really hurting me, tracing through the history not sure where to help.

On #2640056 the last comment states "don't use this patch for now. I don't know how @zuuperman tackled it in the end, but we talked in IRC and we were close to setting this to won't fix".

Not sure if I should be suggesting Paragraphs use Inline Entity Form or whether a core hook to allow allow alteration of entity forms is the thing I should throw my weight behind.

What is the current thinking I am happy to help if I can?

nils.destoop’s picture

We also used paragraphs for a project, but we switched to custom entities + inline entity form. Inline entity form has a hook that was used to fix #2645570: Field Group not working on node edit inside inline entity form. Paragraphs had multilingual issues, so it was not an option for us.

As a work around, you can use paragraphs for the entities, but inline entity form for the UI. I could create an issue in paragraphs to provide a hook. As inline entity form will get into core in one of the next major releases, the core patch will probably never get in. Contribs that want to show an entity form in an entity form, should then always use inline entity form.

reekris’s picture

I'm still having this issue but it seems like the core patch idea is more or less abandoned? A similar issue regarding inline entity form was fixed #2645570: Field Group not working on node edit inside inline entity form. Maybe something similar can be done in the Paragraphs module? so maybe an issue should be opened in the Paragaphs issue queue to get some attention from the maintainers there?

Edit:
Added an issue in the Paragraphs queue: #2675136: Field Group not working on node edit inside paragraph

Revathi Manohar’s picture

hi,
i have checked with the paragraph module.image and the paragraph is groupedtest

thank you

ExTexan’s picture

+1 on getting this resolved.

@Revathi, I'm not sure if you are posting about a different problem or not. Your screenshot shows a node display. This issue is about grouping fields on a node edit form.

Gravypower’s picture

For anyone interested I have created a patch to make field groups work with paragraphs.

You will need to apply a patch to core first however https://www.drupal.org/files/issues/drupal-module-alter-entity-form-buil...

I am very new to the drupal world so if I have done anything wrong please point it out.

Aaron

UPDATE:
I missed an import in the patch
use Drupal\Core\Entity\FieldableEntityInterface;
I will try and create a new patch at some point

Gravypower’s picture

New patch adding in the missing namespace in the module file

Edit:
this was generated on dev and did not apply to 8.x-1.0-rc4, sorry

Gravypower’s picture

This patch is for 8.x-1.0-rc4

Tregonia’s picture

The patch in #14 has had no effect for me.

Gravypower’s picture

@Tregonia did you also apply https://www.drupal.org/files/issues/drupal-module-alter-entity-form-buil...? See my comments in #12

rolfmeijer’s picture

Status: Active » Needs review

I guess the status should be Needs review.

Status: Needs review » Needs work
Tregonia’s picture

@Gravypower

Yes I applied both patches, but I am wondering if I was trying to use this incorrectly. I was hoping that this would affect the node/add and node/edit forms. However, I am not certain that those are entity inline forms.

Should these work on these node maintenance pages?

fomenkoandrey’s picture

FileSize
191.33 KB
81.65 KB

I know how the module works in version D7, but do not understand how it works in D8...

drupal 8.1.3,
dev version of the mod,
node/add .../edit forms

accordion - doesnt work at all, just jum to top at url#
no errors in firebug

Gravypower’s picture

@fomenkoandrey I think you may want to open up a support request issue? This issue is discussing the use of field groups within paragraphs.

Gravypower’s picture

@Tregonia that was where I was using them. I have not looked at this in a while so there may have been changes in the latest version of this module or core that is causing it not to work any more. If I get a chance today will try and see if its still working and post the steps I took to get it all going.

fomenkoandrey’s picture

Thank you.
I use the option with tabs, it works fine.
I wrote about the problems that are discovered while test the mod.
maybe it will help fix them.

jwilson3’s picture

Works for me with a small reroll to apply against latest head. This is RTBC, with the only caveat that it depends on a core patch. :'(

Steps to test:

1) Apply the core patch at:

https://www.drupal.org/files/issues/drupal-module-alter-entity-form-buil...

2) Apply the patch attached to this comment, which is a reroll of comment #14.

I'm using the "Div" style for my field groups inside my Paragraph Types' Form display. I'm even using nested field groups for nested divs, to create multi-column layouts on the node edit form, so the paragraph has the same layout / display on the backend that it does on the front end (to help content editors visualize the columns in their paragraph types.

This is working marvelously. Thanks for the work on this.

The Webmaster Centre Ltd’s picture

Can this patch be rolled back to D7? We have the same issue there. Or should I open a new separate issue?

tsplash’s picture

Not sure whether it's best to use the method above to fix this, or us the patch for the paragraphs module instead at https://www.drupal.org/node/2675136. However when using the patch in #24 coupled with the core patch, I did notice that it only applies to the 'default' form mode. The attached patch gets the current form mode using getMode() on the entity form display object from $form. May not be the nicest way of doing it though...

Patch is for 8.x-1.0-rc4

james.williams’s picture

Version: 8.x-1.0-rc4 » 8.x-1.x-dev
FileSize
1.45 KB

Patches should really be made against current dev version, so here's one. (I know it's useful to have patches that can apply against a specific release too, but they can't get easily merged into the module so will be slower to get committed.)

M_Z’s picture

After applying patch #26 (but it should be the same for patch #27) I got the following PHP strict warning:

"Strict warning: Only variables should be passed by reference in field_group_entity_form_build_alter() (line 163 of modules/field_group/field_group.module)."

I use PHP 5.6.10.

The solution to get rid of the warning message was to replace the line

$display = array_shift(array_pop($form['#process']));

that combines array_shift() with array_pop() functions by 2 lines that separate both functions:

$display_help = array_pop($form['#process']);
$display = array_shift($display_help);

E.g. see http://stackoverflow.com/questions/9848295/strict-standards-only-variabl... where the

tsplash’s picture

@M_Z Thank you for pointing that out, this patch implements your fix on 8.x-1.x-dev.

@james.williams Thank you for the tip.

Algeron’s picture

Not sure if this is related or should be in a seperate issue:
When a Paragraph viewmode has an empty Field Group in it, I get the following error (tested with patches #24 and #29):

TypeError: Argument 2 passed to Drupal\Component\Plugin\PluginManagerBase::createInstance() must be of the type array, null given, called in ds/ds.module on line 315

Using a debugger, I've been able to track it down to the field_group_field_group_build_pre_render_alter() function.

Steps to reproduce:
- Create a "Preview" paragraph viewmode and set it to display on the entity edit form.
- Add a field group and disable it: http://i.imgur.com/rlPYoIi.png

Workaround is to remove the field group from the display. It makes sense to do so since it's empty anyway, but it can be overlooked when Preview copies the DS settings from Default.

james.williams’s picture

@Algeron - would you get the same issue with an empty/disabled field group on a node? I'd be surprised if the issue was actually specific to this work to get field groups on paragraphs.

mikemccaffrey’s picture

FYI, the patch that was created for the Paragraphs module to solve this problem works well:
https://www.drupal.org/node/2675136

If you are looking to solve the problem on your own site, that seems like the best solution to use until the core issue with the new alter hook is resolved.

SteffenR’s picture

The patch in #29 no longer works with latest version of field_group. Attached you find a rerolled patch fixing the issue.

SteffenR’s picture

Status: Needs work » Needs review
JeroenT’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

robin.ingelbrecht’s picture

I installed latest DEV version on Drupal 8.2.5 and I still got the problem described by the topic starter. I also added the patch the implements hook_entity_form_build_alter... still nothing?

nils.destoop’s picture

This was fixed in the paragraphs module. They implemented the support for field_group.

demonde’s picture

There are no field groups available in the paragraphs edit form with Drupal core 8.5.3 and latest dev of Field Group and Paragraphs.

Sorry for this comment, I was wrong.

hockey2112’s picture

I am experiencing this issue today. I create a field group within my paragraph's "Manage Form Display", but it does not take effect.

nimoatwoodway’s picture

Confirm problem: Upgraded field_group from 3.0.0-beta1 => 3.0.0-rc1.

After the Upgrade grouping does not work within paragraphs on node edit pages. It does work within the modal of the geysir module.

Already tried to change widget from Classic to Experimental but does not work either.

I'll set a post to the corresponding paragraphs ticket since it was fixed there last time.