Problem/Motivation
list_allowed_values_string() function warning when list options are determined by 'allowed_values_function'
Steps to reproduce:
Instructions here: https://www.phase2technology.com/blog/setting-allowed-values-function-pr...
Create a 'list_integer', 'list_float', or 'list_text' field with allowed_values_function and visit the field UI:
admin/structure/types/manage/CONTENT-TYPE/fields/field_NAME
Error message:
Warning: Invalid argument supplied for foreach() in list_allowed_values_string() (line 349 of modules/field/modules/list/list.module).
Proposed resolution
Avoid the call if the options are determined by 'allowed_values_function'
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 3025439-4.patch | 2.2 KB | joelpittet |
| #4 | 3025439-4-tests-only.patch | 1.42 KB | joelpittet |
| #2 | 3025439-2.patch | 792 bytes | joelpittet |
Comments
Comment #2
joelpittetComment #3
joelpittetComment #4
joelpittetWrote a test for this, noticed that it may be a bug in features exporting the empty value as an empty string... but I still think it's a logical bug so I'm hoping to get it in.
Comment #6
joelpittetBumping, because has tests... and I don't write tests much/enough
Comment #8
mcdruid commentedThank you for the very detailed summary, and the tests to go along with it!