Problem/Motivation

As content editor, for some fields and referenced entities, you may want the inline entity form to automatically open in "edit" mode as soon as you start editing the main entity. In order to save multiple useless clicks.

Proposed resolution

Provide a field widget setting for the inline entity form complex widget that allows to check "auto-open the edit form".

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

filsterjisah created an issue. See original summary.

filsterjisah’s picture

filsterjisah’s picture

Status: Active » Needs review
filsterjisah’s picture

StatusFileSize
new3.17 KB

Removed unwanted code formatting.

The last submitted patch, 2: inline_entity_form-auto_open_edit_mode-3247446-1.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

anybody’s picture

Title: Auto-open inline entity forms » Auto-open inline entity forms (especially for cardinality: 1)
Issue tags: +UX
Related issues: +#2637880: Ability to reference an entity and auto open its edit form
StatusFileSize
new70.74 KB

Especially for a cardinality of "1" (single referenced entity) this would be a HUGE UX benefit!

I'm not sure if this also makes the same sense for multi-value references, but for single values it definitely saves one click and a better workflow!

Here's an example of the current results with the advanced widget referencing a single block_content. You see, why it's not the best you can imagine being forced to always do the Edit ("Bearbeiten") extra click:
Extra click

The patch is a good first step, but I think the edit form should then also contain the option to remove the entity.

filsterjisah’s picture

Depending on the case it can always makes sense to open references, either multiple values or just a single one.

This patch follows the inline entity form module:
- first hit the "cancel" button in the edit form
- click the "delete" button in the list form

I guess it make sense to add a delete button on the edit form as well. Feel free to make a patch update suggestion ;)

filsterjisah’s picture

For my implementation the inline entity form widget is a required field. So deleting the reference (many many fields) is not really needed, just editing the fields of the reference is ok. When referenced entities are also managed somewhere global, this changes things.

anybody’s picture

@filsterjisah thanks, yes, I didn't mean to criticize anything. In the opposite, agreed with your idea and added some further points and arguments.

I guess best would be to first have maintainer feedback before proceeding with the implementation. This has UX implications which should be signed off first, I think.

geek-merlin’s picture

Issue tags: +Needs tests

Thanks @Anybody for doing some issue gardening, i really appreciate that.
Working this through...

The feature sounds reasonable, tentative green light for that.

The new function prepareFormState in this issue looks overly complex, but this can be mitigatzed. I'm also open to suck the other issue in here.

So this might mean:
- Move logic from prepareFormState to the place used in the other issue's patch
- Close the other issue as dup of this one
- Add in the feature of the other issue (i don't think we need a setting for that) (and find better query parameter names)
- Manually test
- Add automatic tests

What u think?

podarok’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Status: Needs review » Needs work
git apply inline_entity_form-auto_open_edit_mode-3247446-3.patch 
error: patch failed: config/schema/inline_entity_form.schema.yml:72
error: config/schema/inline_entity_form.schema.yml: patch does not apply
error: patch failed: src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php:105
error: src/Plugin/Field/FieldWidget/InlineEntityFormComplex.php: patch does not apply
bharath-kondeti’s picture

Assigned: Unassigned » bharath-kondeti

I will work on the patch re-roll

bharath-kondeti’s picture

Assigned: bharath-kondeti » Unassigned
Status: Needs work » Needs review
StatusFileSize
new3.58 KB

Patch re-rolled against 2.0.x branch. Please review

podarok’s picture

Version: 2.0.x-dev » 2.0.0-beta6
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

geek-merlin’s picture

Version: 2.0.0-beta6 » 3.x-dev
Status: Closed (fixed) » Needs review
Related issues: +#3401656: Clean up problematic 2.x branch

Bulk reopen.

geek-merlin’s picture

Status: Needs review » Needs work

As the issue tag states, this needs tests to be committed.

jonathanshaw’s picture

The approach proposed here does not handle well the situation of nested IEFs, when Cancel is pressed on the parent IEF. This is because of inline_entity_form_close_all_forms() I think, that function seems to override what this patch does.

geek-merlin’s picture

@jonathanshaw
I don't grok it fully but maybe you can describe the exact steps that uncover the problem you describe, the chances that your objection gets into the tests drastically increase.

jonathanshaw’s picture

Re #20 from memory:
1. Sitebuilder: Nest once complex IEF inside another
2. Sitebuilder: Set the inner one to auto open
3. User: Open an entity in the outer IEF; SUCCESS the inner IEF auto opens properly.
4. User: Cancel the opened outer IEF
5. User Open the same entity again in the outer IEF; FAILURE the inner IEF does not auto open now!

dcam credited rhovland.

dcam credited vyasamit2007.

dcam’s picture

I closed #2792971: Expand inline entity form widget setting as a duplicate. I'm granting credit to @vyasamit2007 and @rhovland for work done on a patch in that issue. But the patch was fairly similar. I don't know that there's anything that would be useful from it.

Everyone please remember to check for existing issues before opening a new one. Today I've closed two issues that were older than this one.

filsterjisah’s picture

Patch re-rolled against 3.0.x branch.