Complex widget's "Add existing..." does not use label override

Created on 11 October 2023, 9 months ago
Updated 2 November 2023, 8 months ago

Problem/Motivation

When entity label override values have been provided in the complex widget settings, the widget does not use the overridden label for the "Add existing..." button. Instead, it reverts to "Add existing node".

Example Complex Widget Settings

Resulting IEF Widget

The issue occurs at lines 758-759 of InlineEntityFormComplex.php.

  $this->createInlineFormHandler();
  $labels = $this->inlineFormHandler->getEntityTypeLabels();

Prior to this point $labels is loaded with the correct, overridden values (the correct value was used to build the "Add new President" button in the screenshot). But the call to NodeInlineForm->getEntityTypeLabels() then sets the values to 'node/nodes' without regard for any overrides.

  public function getEntityTypeLabels() {
    $labels = [
      'singular' => $this->t('node'),
      'plural' => $this->t('nodes'),
    ];
    return $labels;
  }

Steps to reproduce

On a complex widget:

  • Enable 'Override labels'
  • For Choose config labels buttons, select 'Configure simple text'
  • Provide label override values
  • Enable 'Allow users to add existing [plural label].'

Proposed resolution

I'm not sure, but it's not clear to me why the "inlineFormHandler" doesn't respect label overrides OR why we even need to reload the $lablels array at that step in the build.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States justcaldwell

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024