Needs work
Project:
Extra Field
Version:
3.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 May 2023 at 14:35 UTC
Updated:
3 Apr 2025 at 16:13 UTC
Jump to comment: Most recent
I try to use extra field with field group. I have no problem in displaying extra fields in groups when displaying the entity.
But in the create or edit form, extra field displays outside his group,
It have works with 1.1 version and the patch that add this functionality, but not with 2.x version.
Install field group, extra field and extra field exemple.
Add a group (html element or fieldgroup) in the form display of any content type and move the exemple markup inside.
Try to create a content of this type. The extra field is outside.
And is it is the only element of the group, the group is not display.
Comments
Comment #2
dcraig91 commentedSame problem here
Comment #3
jaapjan commentedWhich version of the patch did you use before? In our site we used https://www.drupal.org/files/issues/2019-01-17/extra_field-using_in_form.... Here you can see (in ExtraFieldFormManager::entityView) that the plugin element was always returned inside a new form field of type container with a widget. Like so:
But in the new 2.x version the element is printed directly. See FormManager.php::entityFormAlter, line 133:
Going back to your example extra field plugin (ExampleMarkup):
Current code is:
It will fix the problem if you change this to:
I think this means that we have two options:
1. Developer is responsible for adding a type to your extra_field element. We should probably add this in the examples if we go down this route.
2. Restore the way the element is added to the form, like in patch 24 or add a fallback when there is no #type provided we add type 'container' to the render array. This may have some impact on existing installations using the 2.x branch of this module.
Curious to hear what the maintainers think of this.
Comment #4
marieascomedia commentedIt seem that I use this version of the patch :
https://www.drupal.org/files/issues/2019-07-31/extra_field-using_in_form...
I will try your option with the container and let you know the result.
Thank you.
Comment #5
marieascomedia commentedYour solution is working.
Thank you.
Comment #6
pcambraComment #7
pcambraThis is probably more a documentation/example than anything that the module needs to do, maybe we could add a simple element with field_group example?
Comment #8
enchufeThank you #3! Your documentation worked for me out of the box.
Comment #9
mlncn commentedWe have a module built on Extra Field Plus (and friends) - https://www.drupal.org/project/create_referencing_content - that seems to be running into this for entity view display, not only the form as described here, with Field Group 3.x. Is there any similar special markup as described here for the widget that that needs to be part of the formatter for it to work as expected?
I'm pretty confused about this issue too… definitely needs either better documentation across the Extra Field ecosystem or if Extra Field can non-intrusively ensure pseudofields always work with Field Group module, that's ideal?
Comment #10
pcambra