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).
Comment | File | Size | Author |
---|---|---|---|
#33 | field-group-alter-drupal-module-alter-entity-form-2637148_33.patch | 1.53 KB | SteffenR |
Comments
Comment #2
Petr IllekComment #3
reekris CreditAttribution: reekris commentedI'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?
Comment #4
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedI 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
Comment #5
reekris CreditAttribution: reekris commentedThat's great, keeping my fingers crossed they merge your patch for the next Drupal release then!
Comment #6
sachbearbeiter CreditAttribution: sachbearbeiter commentedDitto ;)
Comment #7
chris_hall_hu_cheng CreditAttribution: chris_hall_hu_cheng as a volunteer commentedThis 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?
Comment #8
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedWe 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.
Comment #9
reekris CreditAttribution: reekris commentedI'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
Comment #10
Revathi Manohar CreditAttribution: Revathi Manohar as a volunteer and commentedhi,
i have checked with the paragraph module.image and the paragraph is grouped
thank you
Comment #11
ExTexan CreditAttribution: ExTexan commented+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.
Comment #12
Gravypower CreditAttribution: Gravypower commentedFor 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
Comment #13
Gravypower CreditAttribution: Gravypower commentedNew 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
Comment #14
Gravypower CreditAttribution: Gravypower commentedThis patch is for 8.x-1.0-rc4
Comment #15
Tregonia CreditAttribution: Tregonia at Parallax Information Technology commentedThe patch in #14 has had no effect for me.
Comment #16
Gravypower CreditAttribution: Gravypower commented@Tregonia did you also apply https://www.drupal.org/files/issues/drupal-module-alter-entity-form-buil...? See my comments in #12
Comment #17
rolfmeijer CreditAttribution: rolfmeijer at Dutch Open Projects commentedI guess the status should be Needs review.
Comment #19
Tregonia CreditAttribution: Tregonia at Parallax Information Technology commented@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?
Comment #20
fomenkoandrey CreditAttribution: fomenkoandrey commentedI 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
Comment #21
Gravypower CreditAttribution: Gravypower commented@fomenkoandrey I think you may want to open up a support request issue? This issue is discussing the use of field groups within paragraphs.
Comment #22
Gravypower CreditAttribution: Gravypower commented@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.
Comment #23
fomenkoandrey CreditAttribution: fomenkoandrey commentedThank 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.
Comment #24
jwilson3Works 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.
Comment #25
The Webmaster Centre Ltd CreditAttribution: The Webmaster Centre Ltd commentedCan this patch be rolled back to D7? We have the same issue there. Or should I open a new separate issue?
Comment #26
tsplash CreditAttribution: tsplash as a volunteer commentedNot 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
Comment #27
james.williams CreditAttribution: james.williams at ComputerMinds commentedPatches 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.)
Comment #28
M_Z CreditAttribution: M_Z commentedAfter 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
that combines array_shift() with array_pop() functions by 2 lines that separate both functions:
E.g. see http://stackoverflow.com/questions/9848295/strict-standards-only-variabl... where the
Comment #29
tsplash CreditAttribution: tsplash as a volunteer commented@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.
Comment #30
Algeron CreditAttribution: Algeron at XIO commentedNot 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.
Comment #31
james.williams CreditAttribution: james.williams at ComputerMinds commented@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.
Comment #32
mikemccaffreyFYI, 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.
Comment #33
SteffenRThe patch in #29 no longer works with latest version of field_group. Attached you find a rerolled patch fixing the issue.
Comment #34
SteffenRComment #35
JeroenT#2675136: Field Group not working on node edit inside paragraph is fixed, so this issue can be closed.
Comment #37
robin.ingelbrecht CreditAttribution: robin.ingelbrecht at EntityOne commentedI 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?
Comment #38
nils.destoop CreditAttribution: nils.destoop as a volunteer and at Wunder commentedThis was fixed in the paragraphs module. They implemented the support for field_group.
Comment #39
demonde CreditAttribution: demonde commentedThere 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.
Comment #40
hockey2112 CreditAttribution: hockey2112 commentedI am experiencing this issue today. I create a field group within my paragraph's "Manage Form Display", but it does not take effect.
Comment #41
nimoatwoodwayConfirm 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.