Updated: Comment #90
Entity field classes should be able to implement methods that declare a list of possible and settable values for the field. This is field specific information and should live directly on the Field class. We want to get rid of the procedural style hook_options_list().
Add an AllowedValuesInterface with methods to get all possible options for a field and all settable options for a field. Implementations could be dependent on the current user, so we need to pass that to the methods. Example: the settable options of a workflow state field vary per user, admins can use more options than editors. And we need one method to retrieve the plain values, and one to get a formated options array of values with labels. ==> 4 methods.
Provide feedback on the latest provided patch.
User interface changes
hook_options_list() is removed/deprecated, methods on Field classes are added with AllowedValuesInterface
Original report by fago
As fields have hook_options_list and d7 entity api module had 'options list' callbacks, we want add something similar to property definitions.
We could just follow hook_options_list() what supports opt-groups and generate the flattened allowed values out of it. A requirement that came up in the d7 entity.module was being able to differentiate between 'view' and 'edit' options, e.g. possible already set values and possible values to set. Then, we want to integrate this with validation - so maybe this is better postponed until we know how validation works exactly.
PASSED: [[SimpleTest]]: [MySQL] 58,476 pass(es).
PASSED: [[SimpleTest]]: [MySQL] 58,188 pass(es).
PASSED: [[SimpleTest]]: [MySQL] 58,506 pass(es).