Error on node edit form if entity_hierarchy field is hidden from form display

Created on 3 October 2023, 12 months ago

Problem/Motivation

If entity hierarchy field is hidden from form display and value if added programmatically instead, hook_form_alter throws the following error:

Notice: Undefined index: field_serial_of in entity_hierarchy_form_alter() (line 116 of /var/www/html/web/modules/contrib/entity_hierarchy/entity_hierarchy.module)

Steps to reproduce

1. Add entity hierarchy field to a node.
2. Hide the field from form display
3. On node create, populate the field programmatically
4. Create a new node

Proposed resolution

Add a condition to check if field exists on the form.

Remaining tasks

Create a patch - DONE
Review and merge

User interface changes

N/A

API changes

N/A

Data model changes

N/A

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code (module)

Created by

🇮🇳India bibliophileaxe

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

Comments & Activities

Production build 0.71.5 2024