We recently decided to no longer offer users the ability to edit the Title field of the entity we are editing with ief_popup.

So in that Entity's "Manage form display" tab, in the "Inline Entity Form" custom display settings, I dragged the Title field into the Disabled section.

But now when I click to edit an entity using this IEF Popup, I get this error message:
Oops, something went wrong. Check your browser's developer console for more details.

In the browser console, I see this:
Warning: Trying to access array offset on value of type null in /var/www/html/docroot/modules/contrib/ief_popup/ief_popup.module on line 213

Issue fork ief_popup-3499530

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

dan3h created an issue. See original summary.

dan3h’s picture

Line 213 is this:
$entity_title = $ief_form['title']['widget'][0]['value']['#default_value'];

Inspecting that, I found that that $ief_form['title']['widget'] contains [ 0 => null ].

$ief_form['#default_value'] is set to the Node that is being edited. As such, line 213 can be changed to:
$entity_title = $ief_form['#default_value']->get('title')->value;

This is in the 'edit' action. The 'duplicate' action looks to be handled identically, and so I've included the same fix for that.

chrisck’s picture

  • chrisck committed f3b8ebee on 2.2.x authored by dan3h
    Issue #3499530 by dan3h, chrisck: Error if Title field not included in...
chrisck’s picture

Looks good! Thank you @dan3h for your contribution.

chrisck’s picture

Status: Active » Reviewed & tested by the community
chrisck’s picture

Status: Reviewed & tested by the community » Fixed
chrisck’s picture

Version: 2.2.2 » 2.2.x-dev

Status: Fixed » Closed (fixed)

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