I have defined a custom element (extends FormElement).
The “process” function defines:
$element[‘master’] = array(…) //checkbox
$element[‘details’] = array(…) //container
$element[‘details’][‘options’] = array(…) //radios
The container is needed to dynamically show/hide the extra options.
The custom element works as expected up to a point. The value returned is always an array with master, details keys.
I need the value to return exactly one string (based on different options given), not the full structure of the inner elements.
No matter what I return from “valueCallback” function, the value contains the original $input.
The function is called and it works as I have logged messages and can see the returned values. But the element value is just not set as expected.
Setting #tree to FALSE, avoids the extra tree structure, but it completely ignores the value, thus is not usable at all.
How should we set the value of a custom element (independent of the inner elements)?
Any suggestions are welcome…