Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Other options will be never added permanently to the list of options using a multiselect widget (it works nice for single select).
Have a look at following code fragment:
if (
$element['select']['#value'] == 'select_or_other' &&
!empty($element['other']['#value']) &&
!isset($element['#options'][$element['other']['#value']])
) { ...
The first condition isn't fulfilled using multiselect widgets (it contains an array with key and value 'select_or_other' instead of a string 'select_or_other'). Perhaps we can simply add a condition for multiselect checking for key:
if (
($element['select']['#value'] == 'select_or_other' || isset($element['select']['#value']['select_or_other'])) &&
!empty($element['other']['#value']) &&
!isset($element['#options'][$element['other']['#value']])
) { ...
For me, it works, but I'm not sure if this change is useful?
Comments
Comment #1
danielb CreditAttribution: danielb commentedcheers I changed it to
more consistent with the way it's done elsewhere
thanks!
Comment #3
danielb CreditAttribution: danielb commented-