Skip to content
Snippets Groups Projects
Commit 2ac86c88 authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

#24023 by chx. Allow multiple select options with the same value and implement...

#24023 by chx. Allow multiple select options with the same value and implement it for taxonomy selection.
parent 83064444
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -890,6 +890,9 @@ function form_select_options($element, $choices = NULL) {
$options .= form_select_options($element, $choice);
$options .= '</optgroup>';
}
elseif (is_object($choice)) {
$options .= form_select_options($element, $choice->option);
}
else {
$key = (string)$key;
if ($value_valid && ($element['#value'] == $key || ($value_is_array && in_array($key, $element['#value'])))) {
......
......@@ -1101,7 +1101,9 @@ function _taxonomy_term_select($title, $name, $value, $vocabulary_id, $descripti
if ($tree) {
foreach ($tree as $term) {
if (!in_array($term->tid, $exclude)) {
$options[$term->tid] = str_repeat('-', $term->depth) . $term->name;
$choice = new stdClass();
$choice->option = array($term->tid => str_repeat('-', $term->depth) . $term->name);
$options[] = $choice;
}
}
if (!$blank && !$value) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment