Re-arraging the learning path Form Display fields causes, TypeError: key(): Argument #1 ($array) must be of type array, null given in key() (line 462 of modules/contrib/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php).

Created on 24 January 2023, almost 2 years ago

Problem/Motivation

When you try to re-arrange the Form fields of the learning path in /admin/group/types/manage/learning_path/form-display causes

TypeError: key(): Argument #1 ($array) must be of type array, null given in key() (line 462 of modules/contrib/entity_browser/src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php).

Steps to reproduce

This due to the field not having the correct widget

Step 1. Go to /admin/group/types/manage/learning_path/form-display and re-arrange the fields.

Step 2. Now try to add or edit a training, you will see the website encountered an unexpected error. Please try again later.

Proposed resolution

1. Thus, the config/install/core.entity_form_display.group.learning_path.default.yml config needs to be updated so the widget is autocomplete.

  • Side note: The optional config in /config/optional/core.entity_form_display.group.learning_path.default.yml is good and doesn't need to updated.

2. As #1 will only deal with new installations, we need a solution for current installations. Add a hook_update_N code that will update the Form Display to the correct widget.

🐛 Bug report
Status

Needs review

Version

3.0

Component

Code

Created by

🇨🇦Canada No Sssweat

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

Comments & Activities

  • Issue created by @No Sssweat
  • @no-sssweat opened merge request.
  • Issue was unassigned.
  • Status changed to Needs review almost 2 years ago
  • 🇨🇦Canada No Sssweat

    Added my proposed solution to MR 10. Please review, thanks!

Production build 0.71.5 2024