Needs work
Project:
Entity Browser
Version:
8.x-2.x-dev
Component:
Field widget
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
25 Oct 2016 at 10:07 UTC
Updated:
1 Sep 2026 at 07:31 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
erik seifert commentedComment #3
erik seifert commentedWithout commented code
Comment #4
erik seifert commented- add comments for function calls
- switch to human readable names in widget
Comment #5
erik seifert commented- add the possibility for inheritance from a inline_entity_form widget
Comment #6
erik seifert commented#5 do not really work. Should be more work or a different feature request.
Add new patch.
- Do respect form mode route parameter in entity_browser_form_alter
Comment #7
erik seifert commentedComment #8
chr.fritschLets trigger testbot
Comment #11
jazzdrive3 commentedIs this issue about setting the form display mode when someone clicks the edit button?
Right now, it looks like it always just used the "default" form mode, even if you have selected a form mode for adding the entity. Is this the problem this issue addresses?
Comment #12
gge commentedI tried #7 with 8.x-2.0-alpha2+2-dev and the patch apply and works nicely. It still needs a bit of polish, like adding an explanation (label) to the select input. This feature makes Entity Browser even more helpful and I hope it gets committed.
Thanks!
Comment #13
recrit commentedThis patch is confusing the display form mode (configurable in the field ui) with the form classes defined in the entity type.
It should build the form using the form display object where the mode should default to "default". The paragraphs widget does a similar edit form build for its subform.
Comment #14
mtalt commentedRe-rolling patch to work with 1.6.
Comment #15
mtalt commentedThe user registration form was not working because the register form class was being set to NULL. This checks that the 'edit' form class exists on the entity before modifying the form class.
Comment #16
afi13 commentedComment #18
hawkeye.twolfRe-rolled to latest
8.x-2.x. Also, I replaced a static conditional in the widget settings form with a States API show/hide.Comment #19
hawkeye.twolfAdds missing schema for the new setting.
Comment #20
hawkeye.twolfAdds form mode to settings summary.
Comment #21
silverham commentedAny reason why this issue has stopped?
Comment #22
silverham commentedTheme around attached if anyone is interested.
Comment #25
dave reidI opened a PR branch for this feature. We found a couple of issues using the latest version:
1. The #states information was hard-coded to a specific field name. This fixes it to work for all field names by dynamically generating the state information.
2. I added a canUseEditButton() method rather than hard-coding around file entity. This returns FALSE by default for file entities.
3. Injected the service to get the list of form modes rather than using \Drupal in a class.
4. Fixes the widget settings summary to show the edit mode label rather than the raw value, matching the 'View mode' summary.
Comment #26
dave reidComment #28
dave reidLatest version based on the merge request, still need to work on fixing the tests but this seems to work correctly.
Comment #30
hawkeye.twolfI haven't dug into why yet, but just noting the patch doesn't seem to work for on the relatively vanilla D9 site I just tried it on. Applies cleanly and the new field widget configuration gets saved correctly, but the form mode doesn't seem to change. I'll probably be coming back to this at some point to investigate further.
Comment #31
jberube commentedThe patch from #28 works for me. I feel it's very important that the edit button honors the desired form mode. I'd really like to see this patch merged in.
Comment #32
pierrepaul commentedPatch #28 is also working fine for me. Let me know if I can help with the tests.
Comment #33
gaydamaka commentedPatch was updated after https://www.drupal.org/project/entity_browser/releases/8.x-2.7
Comment #34
dave reidUpdated patch against 8.x-2.8.
Comment #35
dave reidUpdated patch from MR to remove EntityReferenceBrowserWidget::__construct() now that it's no longer needed.
Comment #38
dave reidI think I've discovered a bug here, that in entity_browser_entity_type_build() we're calling \Drupal::service('entity_display.repository')->getAllFormModes(), which itself will call the entity type build if the cache isn't ready and it becomes a recursive problem I think.
Comment #39
dave reidRe-rolled patch against 8.x-2.8 release.
Comment #40
gaydamaka commentedHi, 39 is not applied to 2.8 release
Comment #41
penyaskitoMarking as NR so the test run. Tested #40 and it applies. Worked well, but wondering if there's some way to use the IEF if that's available for consistency.
Comment #43
scotwith1tAfter applying the latest patch here
Comment #44
dave reid@scotwith1t I think the modal buttons issue is a core bug. See #3151534: "Add another item" field button is displayed as a modal action.
Comment #45
dave reidI solved why the edit dialog was always using the default form mode and not the configured version, it was the routing definition had it hard-coded to default. Functionality wise this is working again.
Comment #46
dave reidComment #47
dave reidPatch version against the latest 2.10 release.
Comment #48
pearls commentedThanks @Dave Reid
#47 worked for me.
+1 for RTBC
Comment #49
pearls commentedUpdate:
Unable to apply patch(#47) when trying to upgrade to .8.2.11 and 8.2.dev.x.3f2260ba
Comment #50
alexander tallqvist commentedRe-rolled the patch for version 8.x-2.11. Seems to be applying / working fine. Running Drupal 10.3.2.
Comment #51
pearls commentedThanks Alexander ,
#50 worked for me. ( version 8.x-2.11 )
Comment #55
alt.dev commentedI re-rolled the MR to the latest version. Attaching the patch that can be applied to the version 2.15.0
Comment #56
stomusicI re-rolled the last patch from #55 to 2.17.0
Comment #57
loze commentedI pushed the patch from #56 to the MR branch, so !4 is current again, and added tests. Thanks @stomusic and @alt.dev for the rerolls.
One change to the patch: It built whichever form mode the widget was set to, and the widget's default setting is
default, so the edit dialog started building the default form instead of the edit form. On entity types that have both, like nodes, that changes the form ID and anyhook_form_FORM_ID_alter()written against the edit form stops running.ParagraphsTestcaught it. Nowdefaultmeans no form mode was picked and the old behaviour stays, while a form mode you actually choose is still used.$form_modealso moved after$requestand gained a default value, so the controller can still be called with two arguments.Added tests to
EntityBrowserEditFormTest:defaultstill gets the edit formCI is green.
phpcs,phpstan,eslint,stylelintandcspellfail the same way on 8.x-2.x itself, so they are not from this branch.Comment #58
miiimoooPatch from #55 with 2.15.0 works for me, and the form mode is used as configured in the modal.
Patch from #55 with 2.16.0 (SECURITY) works for me, and the form mode is used as configured in the modal.
But it lost the default for the `form_mode` in the route declaration for `entity_browser.edit_form`, which breaks other usages:
It was removed in #47 but it doesn't seem necessary.
Patch from #56 does not work for me: the default form mode is used instead.
The patch needs re-rolling for the bigger changes in entity_browser 8.x-2.x