Warning: Undefined variable $parent in Drupal\optgroup_taxonomy_select\Plugin\EntityReferenceSelection\OptGroupEntityReferenceSelection....

Created on 10 October 2023, over 1 year ago

Problem/Motivation

The current HEAD raises the warning

Warning: Undefined variable $parent in Drupal\optgroup_taxonomy_select\Plugin\EntityReferenceSelection\OptGroupEntityReferenceSelection->getReferenceableEntities() (line 74 of modules/contrib/optgroup_taxonomy_select/src/Plugin/EntityReferenceSelection/OptGroupEntityReferenceSelection.php).

potentially many times when trying to add/edit content that uses the new EntityReferenceSelection plugin added in Support other modules that provide their own field widget plugins (e.g. Select2) Fixed .

Also no terms are available to select from.

This is not the fault of the original patch which is well tested and in production use. The bug was introduced in a PHPCS fix to that patch included when it was merged.

Steps to reproduce

Create a content type.
Give it an entity reference field to a populated taxonomy vocabulary, that uses optgroup taxonomy select as its reference method and a select2 widget on its form display.

Try to add/edit such content.

Proposed resolution

Implement a different fix to the PHPCS issue that doesn't break stuff.

Remaining tasks

All the things.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom Eli-T Manchester

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

Comments & Activities

Production build 0.71.5 2024