Timeline for How can I swap an entity form for a given bundle?
Current License: CC BY-SA 4.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 2 at 16:41 | comment | added | Jaypan | drupal.org/project/drupal/issues/3491100 | |
Dec 2 at 10:32 | comment | added | 4uk4 | Yes, it's not perfect. You can't be sure the form workflow will be the same in future Drupal versions. Better file a feature request, and in the meantime, add your custom class as an extra form mode and use it exclusively for the bundle, for example with hook_entity_form_mode_alter. | |
Dec 1 at 21:07 | comment | added | Jaypan | Yeah. From a processing point, the original form is still generated before being swapped, so it's not a perfect solution, but it works very well for the time being. | |
Dec 1 at 16:33 | comment | added | Clive♦ | Isn't that always the way :) It would still be nice to have proper support for this, feels like it wouldn't take much to implement. A feature request may be brewing... | |
Nov 30 at 16:15 | comment | added | Jaypan | I was overthinking it. It was actually quite simple. | |
Nov 30 at 16:04 | answer | added | Jaypan | timeline score: 3 | |
Nov 30 at 8:05 | history | edited | avpaderno♦ | CC BY-SA 4.0 |
fixed a typo
|
Nov 29 at 23:40 | comment | added | Jaypan | Thanks Clive, I've been working at exactly that, but not finding nice solutions. I can get the form to load, but trying to use any submit handlers causes core form errors. I'll keep plugging away! | |
Nov 29 at 21:51 | comment | added | Clive♦ |
I remember looking for the same thing a while back and coming up empty. Looking at the code now (even in D11) there doesn't seem to be any hints that the entity form could be configurable per-bundle. You might have to make do with overriding the form class completely, and using the buildForm method to dispatch to other classes based on the bundle of the form object
|
|
Nov 29 at 19:13 | history | asked | Jaypan | CC BY-SA 4.0 |