This is a first stab (setting to needs review to get feedback, but probably needs testing as-well), at adding more context to list_allowed_values(). Use case:

1) Create two content types with a single field
2) Set the field to get the allowed values by function callback.
3) The allowed values should _change_ according to the content type. With the patch, the function callback gets enough context to act accordingly.

Comments

amitaibu’s picture

StatusFileSize
new1.26 KB

Here's a simple module to test this.

Status: Needs review » Needs work

The last submitted patch, field-allowed-values-context.patch, failed testing.

alexpott’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)

The list_allowed_values() function does not exist anymore and it's replacement has a content entity in the argument.