Check if layout builder extra field component is defined by an Extra Field plugin before attempting to add a settings form

Created on 21 May 2024, about 1 year ago

Problem/Motivation

The module currently doesn't check the source of the extra field component in `extra_field_plus_form_alter()` before attempting to discover the `$fieldPluginId` or to load a settings form using `$extraFieldPlusDisplayManager->getSettingsForm(...)`. If the extra field was provided using `hook_entity_extra_field_info()`, the `$fieldPluginId` will not exist in `$extraFieldInfo` and the call to `$extraFieldPlusDisplayManager->getSettingsForm(...)` using the missing field plugin ID will fail.

Steps to reproduce

With the extra `extra_field_plus` module installed, create an extra field using `hook_entity_extra_field_info()` and attempt to add it to an entity display using Layout Builder (I discovered this while attempting to add an "EVA: Entity Views Attachment" defined field).

The operation should fail along with PHP notices / errors in the site's log.

Proposed resolution

Check if the extra field being processed is in fact defined by an Extra Field plugin. See the attached patch which checks if a `plugin_id` exists for the current `field_name` in `$extraFieldInfo` before doing any further processing.

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΏπŸ‡¦South Africa Daniel Bornman

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

Comments & Activities

Production build 0.71.5 2024