- 🇺🇸United States sidgrafix
+1 (used patch #15) Drupal 10.3.2 and inline_entity_form 8.x-1.0-rc17
Saved me after days of trying to get a field that should NOT be required when the field is part of a media entity using the inline entity form as an option on the content type edit/add form. Specifically when media entity type reference field "video" is used if a video wasn't uploaded a name shouldn't be required. Which cause other issues (as a workaround even tried) including a name when no video file was uploaded which then caused the media entity to be created and it shouldn't have been.
...Frustrating to say the least and the cause of a wicked headache until I finally realized inline_entity_form was causing the overall issue and finally stumbled onto this thread.
(but this is definitely needed) - thought I was going to have to dive into declaring an inline entity form controller for media to get it to work right after having tried every conceivable hook and callback to try and alter the fields #required state to FALSE (almost went with disabling default validation) for the entire node form on submit and validate it all in a callback - so glad I found this instead!Also tried inline_media_form but that made things worse plus had to download it and add drupal 10 in it's info file just to try it.
- 🇮🇳India santhosh@21
#35 patch didn't worked for me as the empty media reference is getting created.
- First commit to issue fork.
- Merge request !136Required fields make an optional IEF (erroneously) required → (Open) created by saidatom
- Status changed to Needs review
25 days ago 5:26pm 8 May 2025 The 3.x branch (#35) version of this patch is causing a POST 500 Internal Server Error having to do with Ajax. The error occurs when you try to add a new entity (adding an existing entity works as expected).
Here's the steps to reproduce the error:
Create a new content type and add a new field "Reference" field. Select "Content" for the entity reference type and configure the field to accept an existing content type. Next select the "Manage form display" tab and edit the new reference field to use "Inline entity form - Complex" and "Allow users to add existing nodes". Create a new page using the new content type and for the new entity reference field, click the "Add existing node" button. Use type-ahead to select an existing node and click the "Add node" button. Nothing happens and errors are displayed in the browser console.dgilbert → changed the visibility of the branch 3099844-required-fields-make to hidden.
dgilbert → changed the visibility of the branch 3099844-required-fields-make to hidden.
dgilbert → changed the visibility of the branch 3099844-required-fields-make to active.
I believe this will fix the bug (#41) in the #35 patch for 3.x branch.