I'm trying to add some nodes using "inline enity form - Complex" for multiple entries. However, after creating a new node and saved, the title showed as "%AutoEntityLabel%". If I save the whole node, quit and come back again, these nodes under inline entity form displayed normally. I am using "Automatically generate the label and hide the label field" setting by the way. Any idea?

Comments

simone960 created an issue. See original summary.

shablm’s picture

This issue exists in Drupal 7 version also. I have the latest version installed, and this issue still exists.

Bensbury’s picture

Same issue too in Drupal 7.
It used to work fine on a site we have, at some point recently we got a report of %AutoEntityLabel% being returned from an inline entity form. If the node is saved and then re-opened (edit) it displays correctly.

We think that the token is trying to pull the value before the entity is created fully and so is returning the token name.
Would that make sense? We will look into it, but someone with better knowledge of the module should maybe be able to figure out if a recent change would be responsible?

I've tested this on an older version of our site in question. Version 1.3 works fine.
Version 1.4 and 1.4+5 (dev) both return %AutoEntityLabel%.

So this suggests the issue is with the module and something that changed in the update.
Hope that helps find the problem.

Thanks.

ikeigenwijs’s picture

We also only 'recently' have this issue in d7.

purushotam.rai’s picture

Priority: Normal » Major
guptahemant’s picture

Status: Active » Needs review
StatusFileSize
new1.43 KB

Here I have created a patch to produce the rendered label correctly.Also I have observed that inline entity form doesn't actually save the entity until you press save button on host entity, hence used the hook_inline_entity_form_table_fields_alter(). to create a new auto label field.
Please review.

gg24’s picture

Status: Needs review » Reviewed & tested by the community

Hi @guptahemant,

I am able to cleanly apply the patch and patch resolves the issue as well.
Thanks for the patch. Issuing RTBC to this issue.

Thanks!

OnkelTem’s picture

I confirm it works for me too.

yogeshmpawar’s picture

Looks good to me, +1 for RTBC.

rgnyldz’s picture

Patch for D7 ??

Can be found in this issue

demonde’s picture

+1 Works for me

markdc’s picture

+1 This works great. Thank you!

Side note: I manage two D8 sites with this setup and both titles just come up blank, no %AutoEntityLabel% as mentioned by op.

geraldito’s picture

patch from #6 works like a charm. thanks!

zekvyrin’s picture

Patch works for me as well.
Thanks!

geraldito’s picture

The patch from #6 doesn't work with the latest official release (8.x-2.1-beta1). In the first moment it seems to get saved and is shown correctly in the form, but when saving the mother node an error message like (translated from spanish) "This entity (node: %AutoEntityLabel%) can't be referenced".

dakwamine’s picture

Patch #6 applies and works on dev branch.

Composer info

Commit: 101b69dc799113d1485f5fe89b9fee07f6308522
Version: 8.x-2.1-beta1+15-dev
Datestamp: 1536175980

Other patches applied

#2923876: Broken when provider !=entityTypeId

scottsawyer’s picture

I am getting an error with this patch when using ief_table_view_mode.

Notice: Undefined index: label in auto_entitylabel_inline_entity_form_table_fields_alter() (line 90 of /public/web/modules/contrib/auto_entitylabel/auto_entitylabel.module)

That module provides an extra field "Title" that is used in the widget display ( when closed ).

Line 90 in auto_entitylable.module looks like this:

  'label' => $fields['label']['label'],

Evidently one (or more) of the 'label' keys doesn't exist.

scottsawyer’s picture

For testing, I wrapper the entire thing in an if statement.

/**
 * Implements hook_inline_entity_form_table_fields_alter().
 */
function auto_entitylabel_inline_entity_form_table_fields_alter(&$fields, $context) {
  // Provide new label field to render.
  if (isset($fields['label'])) {
    $fields['auto_entitylabel'] = [
      'label' => $fields['label']['label'],
      'type' => 'callback',
      'callback' => 'auto_entitylabel_inline_entity_label_callback',
    ];
    // Remove the original label field.
    unset($fields['label']);
  }
}

This results in the extra field not displaying at all.

It's weird because I have an older version of this site where this patch worked perfectly.

colan’s picture

Status: Reviewed & tested by the community » Postponed (maintainer needs more info)

@scottsawyer: Did you apply the patch to HEAD (the up-to-date dev branch, not the last release)? If not, please try that. If it still doesn't work, did you try also applying the other patch mentioned in #16?

scottsawyer’s picture

@colan, I am using the latest 2.x-dev using this patch and the most recent patch from #28 in 2923876.

I filed 3067682 since that is how I discovered the problem. That issue was closed and redirected here.

colan’s picture

Status: Postponed (maintainer needs more info) » Needs work

Thanks for the update. Setting status appropriately. Patches welcome as I don't plan to be working on this myself.

colan’s picture

Version: 8.x-2.x-dev » 8.x-3.x-dev
mnico’s picture

Status: Needs work » Needs review
StatusFileSize
new1.35 KB

I attach the same patch with a small change. The behavior of label field was changed.

colan’s picture

#23: Please provide interdiffs when updating patches: https://www.drupal.org/documentation/git/interdiff

mnico’s picture

StatusFileSize
new908 bytes

Uploaded interdiff file

brandonratz’s picture

@mnico Patch #23 appears to work for fixing the title display but when saving the parent node I receive the following error
This entity (node: %AutoEntityLabel%) cannot be referenced.

Update: This was related to a entity reference view

Patch works

nikitaaswani’s picture

Assigned: Unassigned » nikitaaswani
nikitaaswani’s picture

Assigned: nikitaaswani » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new82.88 KB

I was able to reproduce the issue by following steps:

1. In basic page content type , changed the automatic label setting to Automatically generate the label and hide the label field.
2. In article content type, added a new entity reference field to basic page content type.
3. While adding content for article content type, issue was reproducible.

Patch #23 applies cleanly.
Issue is no longer reproduced after the patch.

After successful patch application

Moving ticket to RTBC.
Thanks!

  • guptahemant authored 4775422 on 8.x-3.x
    Issue #2905230 by mnico, guptahemant, simone960, nikitaaswani: Add...
colan’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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

alexborsody’s picture

Works for me thanks

dhiraj bhagat’s picture

Not working for me. Issue still exist, for different user role.