Needs work
Project:
Drupal core
Version:
main
Component:
field system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
16 Mar 2015 at 15:32 UTC
Updated:
12 Aug 2025 at 12:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
dave reidComment #2
m.stenta+1 for this.
The same code exists in Drupal 8 as well, so it should probably be fixed there first.
https://api.drupal.org/api/drupal/core!modules!field!field.api.php/funct...
Comment #3
m.stentaHere's a patch for 8.0.x.
Comment #5
m.stentaOh... I also just found an issue with the original patch for 7.x. It should be checking $field['settings']['allowed_values_function'], but instead it is checking $field['allowed_values_function'].
Attached is a new patch for 7.x as well.
Comment #6
m.stentaOops... can't check a field setting within empty(). Attached is a new 8.x patch.
Comment #7
Anonymous (not verified) commentedShall we wait until php 5.5 has been updated to test bot? https://www.drupal.org/node/2296557
so we could use the method return value in function.
Comment #9
mgiffordComment #14
isolate commentedRerolling the patch for 7.x because it misses the ['settings'] array key.
Comment #28
smustgrave commentedThank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #31
chr.fritschI have the same use case. I want to switch an existing field from having a static allow list to use the
allowed_values_functionIt was not possible because of this error:
Comment #32
alexpottI think this makes sense. Atm you're allowed to change from having an allowed_values_function to a static list and it cannot validate that either.
I considered whether we should call the new allowed values function on all the values in the list with entity set to NULL but looking at example code we have in core gives me pause...
I also thought about the implementation here - and originally I thought about checking is allowed_values was empty but after more consideration I think the current implementation is correct as the function takes precedence if both are set in options_allowed_values().
Comment #33
alexpottComment #34
smustgrave commentedJust want to leave the tag for stats later. Especially if this one lands :)
Moving to NW for the tests.