The Double Field module allows setting a list of allowed values to a subfield, but the list is static, meaning that it can't list values other that ones defined in the field configuration.
The real use case scenario is to list terms from a specific vocabulary in the first
subfield, with an arbitrary value in the second
subfield.
Currently it's not possible to populate or alter values in the first subfield option dropdown.
Introduce a schema property allowed_values_function
which can contain the name of the allowed values callback and a function getAllowedValues()
. The latter method returns either the result of the allowed values callback or statically defined values.
The similar approach is available in the options
module where the options_allowed_values()
function returns a list or values either from the allowed_values_function
callback or from the configuration.
Add tests.
None.
None.
1. A property named allowed_values_function
is added to the first
and second
subfield config schema.
Closed: won't fix
4.0
Code