Modals with custom form display not loading

Created on 20 October 2022, over 2 years ago
Updated 20 March 2023, about 2 years ago

Problem/Motivation

When trying to add a user entity type with a custom form display I get an ajax error when I hit the create button to load the user form in the modal window. I am running drupal 9.4.8

Steps to reproduce

Create a custom form mode in drupal. In my case a custom user form mode of type "participant"
Select the new mode in the entity reference modal create widget settings from whatever form is referencing the entity
Try to create the new entity in the form

Proposed resolution

I tracked the issue down to the entityreference_modal_create_entity_type_build function. The approach is correct but something may have changed in drupal core?
For some reason getFormModeOptions is not returning any of the custom form modes?
I was able to simply fix my specific issue by adding my own hook_entity_type_build
$entity_types['user']->setFormClass('participant', 'Drupal\user\ProfileForm');

🐛 Bug report
Status

Needs work

Version

1.1

Component

Code

Created by

🇺🇸United States mettasoul

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024