Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
Error notice when saving the form that lets a widget be selected.
Notice: Undefined index: widget_type in field_ui_widget_type_form_submit() (line 752 of core/modules/field_ui/field_ui.admin.inc).
Notice: Undefined index: module in field_ui_widget_type_form_submit() (line 753 of core/modules/field_ui/field_ui.admin.inc).
Notice: Undefined index: widget_type in field_ui_widget_type_form_submit() (line 755 of core/modules/field_ui/field_ui.admin.inc).
Notice: Undefined index: module in _field_write_instance() (line 615 of core/modules/field/field.crud.inc).
Notice: Undefined index: in Drupal\field_ui\FieldOverview->form() (line 143 of core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php).
Steps to reproduce
- Go to the manage fields tab of a content type like article, admin/structure/types/manage/article/fields
- edit a field (like tags) and pick the widget type tab (or click on the widget link from the manage fields table), admin/structure/types/manage/article/fields/field_tags/widget-type
- save it ("continue") button
- see error, and the widget is gone from the field row in the manage fields table
Proposed resolution
(description of the proposed solution, the rationale behind it, and workarounds for people who cannot use the patch)
Remaining tasks
- write test exposing bug
- propose solutions
- write initial patch
- review
- update patch
- repeat
User interface changes
No UI changes anticipated.
API changes
No API changes anticipated.
Related
Found while trying to add a widget setting #1120144: Term Reference Autocomplete widget - add option to match only start of term and expose settings (size, match)
Comment | File | Size | Author |
---|---|---|---|
#5 | field_ui_widget-1872786-5-test-only.patch | 2.32 KB | yched |
#5 | field_ui_widget-1872786-5.patch | 3.29 KB | yched |
#1 | widget-s01-2012-12-22_1347.png | 99.78 KB | YesCT |
#1 | widget-s02-2012-12-22_1348.png | 40.33 KB | YesCT |
#1 | widget-s03-2012-12-22_1349.png | 167.64 KB | YesCT |
Comments
Comment #1
YesCT CreditAttribution: YesCT commentedFollowing the steps to reproduce (it has errors for any field and widget)
1. Go to the manage fields tab of a content type like article, admin/structure/types/manage/article/fields
2. edit a field (like tags) and pick the widget type tab (or click on the widget link from the manage fields table), admin/structure/types/manage/article/fields/field_tags/widget-type
3. save it ("continue") button
4. see error, and the widget is gone from the field row in the manage fields table
Comment #1.0
YesCT CreditAttribution: YesCT commentedUpdated issue summary with steps to reproduce
Comment #2
YesCT CreditAttribution: YesCT commentedThis was introduced by #552604: Adding new fields leads to a confusing "Field settings" form
Comment #3
webchickRan into this while testing #501428: Date and time field type in core.
Since you can't change widget types at all, I believe this is a critical bug.
Comment #4
yched CreditAttribution: yched commentedOn it.
Comment #5
yched CreditAttribution: yched commentedThis was caused by this hunk in #552604: Adding new fields leads to a confusing "Field settings" form :
which changed the structure of the submitted $form_state['values'].
This 'basic' element was there to support a fieldset originally, but if the fieldset is gone, we don't need the 'basic' level at all.
Patch removes it, and adds tests for this "change widget type" UI.
(patch also removes a couple vars that are not actually used)
Comment #6
plachThe patch looks good, fixes the issue and is test covered. RTBC :)
Comment #7
webchickExcellent. :) Thanks a lot, both for the fix and for the tests!
Committed and pushed to 8.x.
Comment #8.0
(not verified) CreditAttribution: commentedUpdated issue summary with notice messages