Adding field groups to the form display of a Paragraph has no effect. The field groups are not added when editing a paragraph entity.

An issue has been raised in the Field Groups queue: #2637148: Field Group not working on node edit inside paragraph but it seems like in Paragraphs current form we would need a core patch to get field groups working.

Can something be done in the Paragraphs module to make this work?

CommentFileSizeAuthor
#53 interdiff-2675136-42-53.txt2.47 KBJeroenT
#53 field_group_not_working-2675136-53.patch3.52 KBJeroenT
#53 field_group_not_working-2675136-53-test-only.patch2.27 KBJeroenT
#48 field_group_not_working-2675136-48.patch3.52 KBJeroenT
#48 interdiff-2675136-42_0-48.txt2.47 KBJeroenT
#48 field_group_not_working-2675136-48-test-only.patch2.27 KBJeroenT
#44 field_group_not_working-2675136-42.patch2.92 KBmiro_dietiker
#42 field_group_not_working-2675136-42.patch2.92 KBesod
#42 interdiff-2675136-40-42.txt3.17 KBesod
#40 field_group_not_working-2675136-40.patch4.41 KBJeroenT
#40 interdiff-2675136-37-40.txt1.52 KBJeroenT
#37 field_group_not_working-2675136-37.patch4.59 KBdrobnjak
#34 field_group_not_working-2675136-34.patch4.23 KBdrobnjak
#27 field-group-not-working-2675136-27.patch1.24 KBesod
#26 field-group-not-working-fix-tests-2675136-26.patch2.66 KBesod
#22 field-group-not-working-2675136-22.patch3.16 KBesod
#17 field-group-not-working-rc4-2675136-17.patch1.18 KBesod
#14 2675136-14.patch1.25 KBacbramley
#11 field-group-not-working-rc4-2675136-11.patch1.1 KBesod
#10 paragraph-group-is-there.png77.37 KBesod
#10 missing-paragraph-group.png111.65 KBesod
#8 paragraphs-2675136-8.patch1.02 KBkevinvhengst
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

reekris created an issue. See original summary.

reekris’s picture

Title: Field Groups not working inside a Paragraph form » Field Group not working on node edit inside paragraph
reekris’s picture

reekris’s picture

Issue summary: View changes
reekris’s picture

#2675136: Field Group not working on node edit inside paragraph
This is the related core issue where it is discussed that instead of patching core it could maybe be solved in the Paragraphs module similarly to how IEF solved it.

Berdir’s picture

Status: Active » Postponed (maintainer needs more info)

The core issue is #2640056: Contrib modules can't alter the building of entity form displays actually. And someone posted there that it works now for them.

reekris’s picture

Oh I had linked the wrong issue..

I set the core issue back to needs review since it seems it is not actually fixed. The same issue is also reported in the field group queue #2637148: Field Group not working on node edit inside paragraph. Question is if the issue should be fixed in core, field group or paragraphs.

kevinvhengst’s picture

FileSize
1.02 KB

We've created a patch that resolves the issue of using the field group module with paragraphs.
This patch is very specific for field groups, but it works for us.

miro_dietiker’s picture

Issue tags: +Needs tests

Please provide a test dependency first for field group.

Then we need to have a test that is implements a field group test.

esod’s picture

Patch paragraphs-2675136-8.patch works for us without a Core patch or a Field Group patch. Here's proof:

drupal chain uses the Drupal console to install and serve Drupal.
$ drupal chain --file=~/.console/chain/quick-start-db.yml
Fill out the form...
Once Drupal is running, 
$ cd drupal8.dev
$ drush uli //or login with the admin credentials
open http://127.0.0.1:8088/admin/reports/status // confirm that the Drupal version is 8.1.7
$ drush -y en paragraphs
$ drush -y en field_group

Add a paragraph type
-------------------
open http://127.0.0.1:8088/admin/structure/paragraphs_type
Click Add paragraphs type
Label
My paragraph
Click Save and manage fields
Click Add field
Add a new field
Text (plain)
Label
My paragraph field
Click Save and continue
Click Save field settings
Click Save settings

Add the paragraph type to the article content type
---------------------------------------------------
open http://127.0.0.1:8088/admin/structure/types/manage/article/fields
Click Add field
Select a field type
Paragraph
Label
Article paragraph
Click Save and continue
Click Save field settings
Tick My paragraph in the Reference Type Details.
Click Save settings

Add a New Group to the content type
--------------------------------
open http://127.0.0.1:8088/admin/structure/types/manage/article/form-display
Add new group
Label
Article group
Group name
article_group
Click Save
Move the Article group above the Article paragraph field
Indent the Article paragraph field so it is contained in the Article group
Move Article group so it is below the Body field

Add a New Group to the paragraph type
--------------------------------
open http://127.0.0.1:8088/admin/structure/paragraphs_type/my_paragraph/form-display
Add new group
Label
Paragraph group
Group name
paragraph_group
Click Save
Move the Paragraph group above the My paragraph field.
Indent the My paragraph field so it is contained in the Paragraph group
Click Save

open http://127.0.0.1:8088/node/add/article
Note that the Article group contains the Article paragraph field
Click Add My paragraph
Paragraph group is not there.

<img src="/files/issues/missing-paragraph-group.png" alt="missing-paragraph-group.png" />

Apply the patch
$ patch -p1 < paragraphs-2675136-8.patch
The Paragraph group now appears.

<img src="/files/issues/paragraph-group-is-there.png" alt="paragraph-group-is-there.png" />

We're having trouble upgrading paragraphs from 1.0-rc4 to 1.0-rc5. We use drush make and the database updates don't run when we build with rc5. For the time being, I'm going to reroll this patch for use with rc4.

esod’s picture

field-group-not-working-rc4-2675136-11.patch is a reroll of paragraphs-2675136-8.patchfor use with rc4.

webflo’s picture

miro_dietiker’s picture

Status: Postponed (maintainer needs more info) » Postponed

Then simply postponed on that issue. Please help make it happen.

acbramley’s picture

FileSize
1.25 KB

Rolled against 8.x-1.x, a bit more code has been added around this area in rc5 so not sure if this is correct.

eloivaque’s picture

#14 Work for me

RKopacz’s picture

Just tried applying #14 to a 8.x-1.x-dev, but still not getting the accordion I inserted in one paragraph type (which accordion was already added to the paragraph type, and the paragraph type was already created, before I updated the module to the dev version). When I tried, I get the message:

Unreversed patch detected! Ignore -R? [n] n

So I ignored the patch and flushed caches etc, thinking that the patch had already been committed in dv, and still no accordion in the paragraph inside the node edit form.

esod’s picture

Rerolling the patch for 8.x-1.x.

There is, of course, a better solution for this issue than this patch. But this patch does keep things going for the time being.

Status: Needs review » Needs work

The last submitted patch, 17: field-group-not-working-rc4-2675136-17.patch, failed testing.

The last submitted patch, 17: field-group-not-working-rc4-2675136-17.patch, failed testing.

miro_dietiker’s picture

Priority: Normal » Major

Promoting. For nice UX, grouping concepts are important and we want to allow these without the need of code.

If you want to get this (workaround) in, please help with test coverage.
Also, put a reference to the core issue with a @todo into the workaround code.

himerus’s picture

I can confirm that #17 seems to work as desired. Horizontal and Vertical tabs work in a Paragraph.

esod’s picture

Added the @todo to the workaround code. Fixed the tests.

Status: Needs review » Needs work

The last submitted patch, 22: field-group-not-working-2675136-22.patch, failed testing.

The last submitted patch, 22: field-group-not-working-2675136-22.patch, failed testing.

miro_dietiker’s picture

If head tests fail again, we need a separate patch. Please don't mix this. But i thought we fixed that already. Did core revert?

esod’s picture

Yes, of course, separate patches. I don't think the test failures are related to the workaround patch. But anyway here is the test patch. I'll assertRaw on the name to try to get the patch to pass on the dispatcher. The tests have no failures on my local system.

I'd love to redesign these tests because they're so long. At the least make them one public function per test class. But that should be another issue.

What seems to have changed is 'fields[status][region]' => 'content', has become 'fields[status][parent]' => 'content',. I don't know if that's a core reversion.

I don't need to test these patches against both PHP5.5 and PHP7 since the PHP version is not relevant to this issue. I know I added the PHP7 test. How do I get the patches to test against only PHP5.5? Thanks.

esod’s picture

Here is the patch for the workaround code with the @todo added. It won't pass testing, so I'm not going to test it. Maybe we should at this point put the test patches into a separate ticket.

The last submitted patch, 26: field-group-not-working-fix-tests-2675136-26.patch, failed testing.

The last submitted patch, 26: field-group-not-working-fix-tests-2675136-26.patch, failed testing.

  • miro_dietiker committed 99a6673 on 8.x-1.x authored by esod
    Issue #2675136 by miro_dietiker: Field Group not working on node edit...
miro_dietiker’s picture

Status: Needs review » Needs work

A feature can only be committed if it has test coverage. We don't do features and test coverage for those in separate tickets.

In order to allow you to implement tests, i committed a test dependency to field_group, so tests can start enable it.

drobnjak’s picture

Assigned: Unassigned » drobnjak
esod’s picture

Ah, test dependency to field_group so tests can start to enable it. Got it. Thanks.

drobnjak’s picture

Created new test, following the group definition and adding fields as children from the FieldGroupUiTest.php and EntityDisplayTest.php tests from the field_group module. In both classes it is defined completely different, since one of them is not using or creating children. Both of them are using FieldGroupTestTrait which I am also using in this test.
Currently trying to resolve errors in adding children to group. Uploading a patch to show progress and for a discussion.

Status: Needs review » Needs work

The last submitted patch, 34: field_group_not_working-2675136-34.patch, failed testing.

The last submitted patch, 34: field_group_not_working-2675136-34.patch, failed testing.

drobnjak’s picture

Test completely reworked, uploading without interdiff. New test (ParagraphsModuleFieldGroupTest) is working completely.

Status: Needs review » Needs work

The last submitted patch, 37: field_group_not_working-2675136-37.patch, failed testing.

The last submitted patch, 37: field_group_not_working-2675136-37.patch, failed testing.

JeroenT’s picture

Created a new patch. Let's see if this fixes all the test failures.

gcharles’s picture

The Latest Patch(#40) Works for me +1

esod’s picture

We can use methods from ParagraphsTestBase to help the test code.

miro_dietiker’s picture

The interdiff is wrong. The patches seem to be stuck...

miro_dietiker’s picture

esod’s picture

I changed the test's name to match the pattern of the other tests names, but neglected to add it to my branch so the interdiff was incomplete.

I see you've uploaded the patch again. Great. :)

miro_dietiker’s picture

Status: Needs review » Needs work

Running this test-only doesn't fail. So the tests don't test something valuable until now.

JeroenT’s picture

Assigned: drobnjak » JeroenT

Looking at the test.

JeroenT’s picture

Changed the test. The problem with patch in #44 is that it was testing a paragraph field in a field_group, instead of testing a field_group in a paragraph entity.

Patch field_group_not_working-2675136-48-test-only.patch should fail.

Patch field_group_not_working-2675136-48.patch contains the test and the fix, so this patch should be green.

The last submitted patch, 48: field_group_not_working-2675136-48-test-only.patch, failed testing.

The last submitted patch, 48: field_group_not_working-2675136-48-test-only.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 48: field_group_not_working-2675136-48.patch, failed testing.

The last submitted patch, 48: field_group_not_working-2675136-48.patch, failed testing.

The last submitted patch, 53: field_group_not_working-2675136-53-test-only.patch, failed testing.

The last submitted patch, 53: field_group_not_working-2675136-53-test-only.patch, failed testing.

  • miro_dietiker committed b2ec083 on 8.x-1.x authored by JeroenT
    Issue #2675136 by esod, JeroenT, drobnjak, miro_dietiker, reekris: Field...
miro_dietiker’s picture

Status: Needs review » Fixed
Issue tags: -Needs tests

Wonderful! Thx for fixing it and that's why we like to see test-only patches. :-)

Committed with clarifying comments. Party, we have field group support now.

drobnjak’s picture

Status: Fixed » Closed (fixed)

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

nimoatwoodway’s picture

Unfortunately the problem with field groups is back. See #40 and #41 Field Group Issue

Upgraded field_group from 3.0.0-beta1 => 3.0.0-rc1 and now the grouping is broken within node edit.
Interesting: It does work within a geysir modal window.

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

Has anyone an idea how this could be fixed? Many thanks for any info.

EDIT: Problem occurs with paragraphs versions 8.x-1.6 and 8.x-1.8 drupal 8.7.3 and 8.7.2

nimoatwoodway’s picture