Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Since release of Field Group RC1, the module supports the experimental field_layout module.
This release removes the needed hook field_group_form_pre_render for paragraphs module to work.
The hook is replaced with field_group_form_process.
Proposed resolution
The paragraph module needs 2 changes to work with the patch.
In class ParagraphsWidget (line: 617) replace:
$element['subform']['#pre_render'][] = 'field_group_form_pre_render';
with:
$element['subform']['#process'][] = 'field_group_form_process';
And in class InlineParagraphsWidget (line: 642) replace:
$element['subform']['#pre_render'][] = 'field_group_form_pre_render';
with:
$element['subform']['#process'][] = 'field_group_form_process';
Remaining tasks
Create patch and tests.
User interface changes
-
API changes
-
Data model changes
-
Comment | File | Size | Author |
---|---|---|---|
#76 | 2907094_76.patch | 1.65 KB | mpp |
| |||
#74 | 2907094_74.patch | 3.42 KB | mpp |
#14 | paragraphs-field_groups-field_layout-2907094.png | 295.24 KB | jwilson3 |
Comments
Comment #2
johnchqueThanks for creating an issue for it. Any chance we can get a patch? We would also need tests for the change.
Comment #3
bserem CreditAttribution: bserem at SoLebIch commentedThe attached patch should do the trick.
It needs patch #11 from https://www.drupal.org/node/2878359
Comment #4
miro_dietikerSupport for common scenarios need test coverage. We already have around field group, so it should be easy to add tests for field_layout as well.
Triggering test bot once..
Comment #6
bserem CreditAttribution: bserem at SoLebIch commentedWith my patch, paragraphs in forms (node/edit etc) do not work.
Paragraphs in the frontend (and ui_patterns with field groups for that matter) work.
It needs work.
Comment #7
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedYour patch is still using #pre_render. With the fieldgroup patch, you need #process.
An updated patch. But not fully working yet. Tabs are loaded, but fields are not in it.
Comment #8
johnchqueTriggering test bot.
Comment #10
nedjoOpened this related issue: #2922650: Move field_group integration of paragraphs to field_group module.
Comment #11
askibinski CreditAttribution: askibinski as a volunteer and at ezCompany commentedThe test needs work, but for anyone reviewing the patch, you also need the field_group patch at #11 #2878359: Field groups are not compatible with field layout.
Comment #12
AnybodyPlease test with the latest patch in #33 of #2878359: Field groups are not compatible with field layout for me that finally fixes this mad problem. Please review and feedback. You can find my feedback in #35 of the other issue.
Test bot will not be able to test this completely I think because both patches are needed in combination?
Comment #13
jwilson3Tested with patch #36 and #33 on #2878359: Field groups are not compatible with field layout and in both cases, while the error messages are gone, I'm hitting an issue where the field_group inside the Paragraph type disappears. If I make the paragraph field 'required' and configure the paragraph widget to auto-create the first instance, then the field_group inside the paragraph gets moved outside the paragraph field, to the main node creation form on /node/add/page.
Comment #14
jwilson3An image to explain the above comment ^
Without either the patch from this issue nor the patch from #2878359 the field groups on the paragraph type works perfectly fine even with field layout module enabled, but breaks when you add a field group to the node itself.
Comment #15
AnybodySadly I have to confirm that we encountered the same problem like described in #13 / #14.
Comment #16
Anybody@jwilson: Please retry with #52 from #2878359: Field groups are not compatible with field layout and provide some new feedback :)
Comment #17
AnybodyI can finally confirm that #7 works in combination with #57 from #2878359: Field groups are not compatible with field layout!
So this can be set RTBC if the failing tests are due to the old fieldgroup version.
How shell we proceed here to finally fix this issue and tests?
Is there a way to run the tests cleanly in Drupal.org CI based on the combination of patches? Does somebody know?
Comment #18
DuaelFrI can confirm the issue is fixed too.
Sadly, we are going to need to wait until Field Group is patched to be able to run our automated tests.
We should wait a new Field Group release anyway or we are going to break BC if this patch is commited before the other one.
Comment #19
AnybodyWe're using the patch in combination with the field groups patch since month now without any further problems. I'll set this RTBC and this should be committed together with the #2878359: Field groups are not compatible with field layout.
Comment #21
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedUpdate: The patch of #2878359: Field groups are not compatible with field layout was just committed to DEV. You can commit this patch. Next step: Check if we can move this to field_group.
Comment #22
AnybodyComment #23
miro_dietikerHappy to see integrations fixed and improved, but we meanwhile have tests for all (other?) contrib modules we integrate with.
Can we simply have a test that checks this is doing what it should, combined with field_group.
Not sure about committing and release sync. Are you saying this was before already integration code that is now broken with Dev? That would require us to sync a next release.
What confuses me even more is that field_group was just majorly refactored in the related issue but there was zero test coverage added / updated...
Comment #24
FiNeX CreditAttribution: FiNeX as a volunteer commentedHi, I've tested the patch and now I can use field_group with Paragraphs module. Thanks!
Comment #25
scottsawyerPatch applies cleanly against Paragraphs 8.x-1.5, seems to work properly with Field Group 8.x-3.x-dev. Paragraph fields now nested properly under field groups, only tested with Field Group types Details and HTML Element.
Comment #26
Martijn de WitChanged issue title, now patch is committed in the field_group module and there is a new version (RC1).
Comment #27
Martijn de WitChanged the issue summary because the patch is now committed in the new released version.
Comment #28
SpokjeI'm a bit confused, could somebody confirm this assumption
This patch is only needed when using
paragraphs
,field_groups
andfield_layout
at the same time. Whenfield_layout
isn't used this patch is not required?Also the fact that this patch throws 4 errors specifically on
field_groups
makes me a bit nervous.Comment #29
scottsawyer@Spokje At one time ( back in January ), I needed this patch for field_group, even though I was not using field_layout, but I was using layout_builder. I don't recall the exact situation, but I am no longer using the patch, probably an update to either field_group or layout_builder subsequently fixed the underlying issue I was experiencing. So, in my case, this patch is not needed.
Comment #30
Spokje@scottsawyer Thanks, really appreciate the elaborate explanation :)
Comment #31
AnybodyCan we please have feedback from more folks, if this patch really isn't needed anymore?
You can see a test example here: https://www.drupal.org/project/field_group/issues/2994053
Did you try vertical tabs WITHOUT this patch?
Comment #32
justcaldwellI haven't had a chance to test without the patch, but FWIW, the release notes for Field Group 3.0-rc1 specifically warn paragraphs users to apply this patch:
Comment #33
SpokjeFor me, vertical tabs work without the patch.
This is the combination used:
Core: 8.6.16
Field Groups: 3.0.0-rc1
Paragraphs: 1.8.0
Main difference, besides module versions, between me and the example provided in #31 seems to be that I'm not using Core Field Layout.
(Which was the main reason behind my initial question in #28)
Comment #34
hudriThis patch is mandatory for me:
Core 8.7.2
Paragraphs 1.8.0
Field Groups 3.0.0-rc1
Field Layout or Layout Builder are not enabled
Neither simple HTML elements like container div's nor vertical or horizontal tabs are working without it. Applying the patch fixes all my problems.
Comment #35
bdlangton CreditAttribution: bdlangton commentedI have the same exact setup as @hudri and the patch is also necessary for me. HTML elements with vertical tabs (haven't tested horizontal) aren't working, but it works with the patch.
Core 8.7.2
Paragraphs 1.8.0
Field Groups 3.0.0-rc1
Field Layout or Layout Builder are not enabled
Comment #36
stevieb CreditAttribution: stevieb commentedPatch is not working for me
Drupal 8.7.2 / Paragraphs 1.x-dev / Field Group 3.0-rc1
Comment #37
weseze CreditAttribution: weseze as a volunteer commentedAttached is an updated patch that works against latest stable of paragraphs (1.8).
The main difference is that this patch actually checks which implementation of field_group is available and implements the correct one. So it works with both field_group 1.x and 3.x.
I will leave this ad "Needs work" because we still need some test.
Comment #38
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedSame situation as #35, using:
- Core 8.7.2
- Paragraphs 1.8.0
- Field Group 3.0.0-rc1
Field Layout or Layout Builder are not enabled
@miro_dietiker, the problem here is not that we don't have a test for field_layout (field_layout is not needed to reproduce this bug). The problem is that we need to test this with Field Group 3.0.0-rc1. Because in version 3, field_group_form_pre_render has been replaced with field_group_form_process.
Comment #39
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedAdded a patch that should work for field_group 2 & 3.
Comment #40
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commented@weseze seems like we both added a patch to support both versions at the same time. I've hidden mine as you added a test to check if the method exists.
Not sure why we'd need extra tests, this should already be covered?
Comment #41
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedComment #43
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedI'm flagging #37 as rtbc as tests are green and I don't see how we could write a test for field_group 3.0 rc1.
Comment #44
ABaier CreditAttribution: ABaier commentedI can confirm, that patch #37 applies cleanly against the latest dev of paragraphs and solved the problem. In our case, before applying the patch, the fields inside of a details element were gone on form display.
Core 8.7.3
Paragraphs 8.x-1.8+9-dev
Field Group 8.x-3.0-rc1
Field Layout and Layout Builder are not installed
Comment #45
temkin CreditAttribution: temkin at SiteCraft commentedSame here. Tested the last submitted patch (#39) and everything works great with it.
Comment #47
Martijn de WitLol stupid testBot is using #39 and removing the status from the issue...
@weseze maybe commit your patch again for the testBot and issue status ?? ;d
Comment #48
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedRerolled #37. Credit should go to @weseze.
Comment #49
Martijn de Wit👍
Comment #50
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedTested ... Patch in #7 is working.
Thank you :)
Comment #51
AnybodyConfirming RTBC of #48. Commit finally?
Comment #52
andybroomfield CreditAttribution: andybroomfield commentedPatch in 48 gives me the following error when using paragraphs with horizontal tabs in field group :
Notice: Undefined index: widget in Drupal\paragraphs\Plugin\Field\FieldWidget\InlineParagraphsWidget->massageFormValues() (line 1329 of modules/contrib/paragraphs/src/Plugin/Field/FieldWidget/InlineParagraphsWidget.php).
I've put a patch to fix this, hope this is done right.
Sorry if I'm holding up getting this released :)
Comment #53
Martijn de WitComment #54
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedSeems weird to add a fix in a line that follows this comment:
i wonder what the testbot would say if we actually remove it.
@andybroomfield, could it be that the notice originates in a missing configuration setting or are you using any other patches?
If we do change it, we should use === instead of ==
Comment #55
andybroomfield CreditAttribution: andybroomfield commentedYes, was a bit strange.
@mpp This is on a vanilla set up when I tested the patches, though I'm getting the error on a couple of sites.
It happens when I save the node.
so if I have a paragraph type that uses field group and horizontal tabs, then I save the node, the error message occurs.
Comment #56
maxrab CreditAttribution: maxrab at arocom GmbH commentedI am using Drupal 8.7.3 and Paragraphs 1.6.0 and the patch in #52 fixes the problem for me. Thanks andy!
Comment #57
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedI tried to do a blame of the code to see why this piece of code was introduced but the commit message didn't contain a reference to a drupal.org issue. Would have been nice to have a reference to an issue somewhere.
Let's see what testbot says if we remove it.
Comment #58
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedRemoving the "Needs tests" tag as:
- I don't see how we could write a test for a release candidate (field_group 3.0 has a rc1)
- I don't know of any module that writes tests to cover future versions of other modules?
- There are tests for field_group 2.x and they're green
@miro, Please inform me if you believe we should still pursue tests and if there's a way to do it.
Comment #59
Berdir> - I don't see how we could write a test for a release candidate (field_group 3.0 has a rc1)
> - There are tests for field_group 2.x and they're green
field_group 1.x, actually, according to composer.json:
"drupal/field_group": "~1.0",
There is no field_group 2.x. What's not possible is having a test for both 1.x and 3.x. But we can pick one version, also an rc, we just need to update the version constraint to what we want. Our existing test will then simply run with that version (and might need to be updated, not sure)
Since 3.x is the only supported version, it makes sense to update to that and test with that.
Comment #60
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedThanks for your input @berdir!
I'll see if I can update the tests to use 3.x.
Comment #61
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedUpdated the dependency for field_group to 3.x since it's currently the only supported version.
Comment #62
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedThis time without the redundant/deprecated(?) code:
Comment #64
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedLooks like the name key is required in 3.x
Let's see if this fixes the tests.
Comment #65
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedThat should have been 'region', not 'name'.
Comment #68
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedTesting with field_group 3.x-dev
Comment #70
AnybodyFYI: #68 worked for me together with #3 from #2986704: Incompatibility with inline entity form
Comment #71
Berdirthis seems unrelated?
Comment #72
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commented"The check to see if mode is present is due to field group tabs."
An extra isset() check with the above comment was introduced in #52 so it would seem to be related. I could not find any history as to why this was introduced in the first place, there's no test for it and the comment mentions to remove the code.
Comment #73
BerdirI think that was an unrelated change, but that doesn't make removing it related :)
#3068880: Undefined index: widget updated that check, so I think there's no reason to remove it here. What's the problem with the notices, is that a field_group or something on our side?
Comment #74
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedReverted that.
I think it's a field_group issue.
Comment #75
BerdirAlright, that sounds like the test is blocked on field_group (and also that 3.x isn't very stable :-/).
One option would be to just commit the changes and then postpone committing the test update until that issue is fixed?
Comment #76
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commentedAgreed, I removed the composer requirement for field_group 3.x.
Comment #77
BerdirCommitted. I'd be fine with closing this and opening a follow-up for the tests.
Comment #79
frankdesign CreditAttribution: frankdesign commentedPatch at #76 works. Thanks
F
Comment #80
mpp CreditAttribution: mpp as a volunteer and at AmeXio for District09 commented@berdir, I created a new issue to write the tests.
Comment #81
demonde CreditAttribution: demonde commentedI installed the dev version of paragraphs and it works for me. Thanks.
Comment #82
AnybodyUsers of field_group, see comment #12 + #13! You may need that additional patch.