Problem/Motivation

I have an entity A that references another entity B using an entity-reference field and inline entity form. The entity-reference field is set to not be required. Entity B has a required field included in its inline entity form.

I want to leave the inline entity for for Entity B completely empty and save entity A. This should save entity A and not create an entity B, leaving the entity-reference field empty.

However, the required field on Entity B stops the form from submitting at all.

Solution

Add some code to inline_entity_form_process_form that bypasses the submit if the values returned are completely empty.

Comments

Category:Bug report» Support request
Issue summary:View changes
Status:Needs work» Fixed

You are probably using the single widget.
It always forces "required", see the code comment:

<?php
 
// The "Single value" widget assumes it is operating on a required single
  // value reference field with 1 allowed bundle.
?>

This is a current design constraint without a clear path forward. What you propose is too hacky.

You can always switch to the multiple widget for your use case, or write a custom widget.

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.