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

Comments

joelpittet created an issue. See original summary.

joelpittet’s picture

Status: Active » Needs review
StatusFileSize
new792 bytes
joelpittet’s picture

Issue summary: View changes
joelpittet’s picture

StatusFileSize
new1.42 KB
new2.2 KB

Wrote 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.

The last submitted patch, 4: 3025439-4-tests-only.patch, failed testing. View results

joelpittet’s picture

Bumping, because has tests... and I don't write tests much/enough

  • mcdruid committed 67207cd on 7.x
    Issue #3025439 by joelpittet: list_allowed_values_string() warning when...
mcdruid’s picture

Status: Needs review » Fixed

Thank you for the very detailed summary, and the tests to go along with it!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.