When auto_entitylabel_form_alter() executes when using the Inline Entity Form widget for entity reference fields with the 'Add new [entity type]' option, when auto_entitylable_form_alter() is called, it get invoked for the parent entity, and not for the 'new' entity being referenced, which means that the auto label processing on the form is not performed.

While there has been work in #1787838: Support Automatic Entity Label module to fix this in IEF proper, I actually have realized that if auto entity label also used hook_field_attach_form() to do its processing, then it covers all cases without much changes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dave Reid’s picture

Status: Active » Needs review
FileSize
1.42 KB

The following patch has worked well for our install.

bforchhammer’s picture

Status: Needs review » Fixed

Ok, I don't see any problems with this. Committed and pushed!

Status: Fixed » Closed (fixed)

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

johnstav’s picture

Status: Closed (fixed) » Needs work

Entity label appears as %AutoEntityLabel% when:
- Add an entity via the inline entity widget
- Save the added entity
- Don't save the parent entity
- Edit the added entity
- Save the added entity again.

bforchhammer’s picture

Status: Needs work » Closed (fixed)

@johnstav: sorry, I have no experience with the inline entity widget. Maybe you can try posting your issue in the IEW queue (possibly in #1787838: Support Automatic Entity Label module); if you find that there's something specific that should be changed in the AEL module, please create a new issue. (In that case a patch would be awesome!)

Dave Reid’s picture

Status: Closed (fixed) » Needs review
FileSize
704 bytes

Actually I confirmed the bug in #4. This needs one small follow-up to create the auto-label using hook_field_attach_submit().

bforchhammer’s picture

Status: Needs review » Fixed

Okay, committed #6. :)

Status: Fixed » Closed (fixed)

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

adam1’s picture

Using latest stable version 7.x-1.2 with patch #6 or latest dev version 7.x-1.2+6-dev, a problem occurs:
when adding a new entity via the inline_entity widget, the auto-entity-title works perfect, but when editing an existent entity inline, the auto-entity-title doesn't work, the title is shown as "%AutoEntityLabel%".

Anonymous’s picture

Issue summary: View changes
Status: Closed (fixed) » Needs work

Using the latest dev versions of Inline Entity Form & Automatic Entity Label, which includes the patch committed at #7, I continue to experience the same problem described at #4:

Entity label appears as %AutoEntityLabel% when:
- Add an entity via the inline entity widget
- Save the added entity
- Don't save the parent entity
- Edit the added entity
- Save the added entity again.

Marking this as 'needs work', since Automatic Entity label does not seem to work fully with Inline Entity Form.

Anonymous’s picture

Applying the patch in comment #2 at https://www.drupal.org/node/2329729 solved this problem for me.

bforchhammer’s picture

Status: Needs work » Closed (fixed)
nithinkolekar’s picture

Status: Closed (fixed) » Active

I am not sure whether this has to be done in #2212861: title autogenerate doesn't always copy updated parent entity title to child commerce products or is it the AEL

When using two bundles like Book author, Books where Book author is parent entity having entityreference field which point to Book entity with Inline Entity Form as widget.

For setting title of Book using AEL (Automatically generate the label and hide the label field) following token is used
[node:field-book-name][node:field-book-ref:0:title] but title from parent node ie Book author title is not injected.

If it is not related to AEL then it can be closed again.

milos.kroulik’s picture

Status: Active » Closed (fixed)

I can confirm, that patch commited in #12 works fine. Can you create separate issue for your problem, please? Setting this back to fixed.

elvisronn’s picture

Patch #6 worked for me. Thanks.

trumanru’s picture

Category: Feature request » Bug report

I see patch #12 in the code of this module. But in my case the problem resolved only after I've applied patch #6.

I think #6 should be included in the module.

Donit’s picture

True, #6 isn't committed. I also get hunks

patch < 1980652-autoentitylabel-field-attach-submit.patch
patching file auto_entitylabel.module
Hunk #1 succeeded at 200 (offset 40 lines).

and still see %AutoEntityLabel% via Inline Entity Form.

julien.reulos’s picture

I also confirm it is only working by adding the patch from #6.

Dakwamine’s picture

Fun fact: I have tried to apply this patch on the D8 version of auto_entitylabel with composer. The patch applied well but, obviously, was not working. For D8 websites, please check #2905230: Title displayed as %AutoEntityLabel% after saving via Inline Entity Form, comment #6.

tory-w’s picture

Confirming patch #6 works.