Notice: Undefined index: field_open_hours in bee_form_alter() (line 137 of modules\contrib\bee\bee.module).

Created on 7 April 2019, about 6 years ago
Updated 23 October 2023, over 1 year ago

Thanks for chiming in.

I just enabled bee (daily booking) on a content type and edited the default form display to not show the office hours fields as I am not going to use them. Then editing a node of the given content type gives me:

Notice: Undefined index: field_open_hours in bee_form_alter() (line 137 of modules\contrib\bee\bee.module).
Notice: Undefined index: field_open_hours in bee_form_alter() (line 145 of modules\contrib\bee\bee.module).
Notice: Undefined index: field_open_hours in bee_form_alter() (line 160 of modules\contrib\bee\bee.module).

Looking at the code, the module obviously expects the field 'field_open_hours' to be on any form display, just to determine a position for other form fields and then to disable it in case of daily bookings (line 211 and 212).

As a workaround I can add the 'field_open_hours' field to my form definition but I don't think this is the way to go. We can define multiple forms per content type to cater for multiple situations by defining what fields we want to have edited and in which order. This form_alter hook just ignores this freedom/flexibility by requiring a specific field to be present on *any* form definition and subsequently defining the order for its own injected form fields (not Drupal fields) itself.

I am wiling to write a patch to change this but don't have enough oversight yet to propose an alternative of defining this in another way.

🐛 Bug report
Status

Postponed: needs info

Version

1.0

Component

Code

Created by

🇫🇷France fietserwin Le Mont-Dore

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024