mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-21235 support for optgroups in select
This commit is contained in:
parent
d776d59ee2
commit
6770330d17
5 changed files with 50 additions and 28 deletions
|
@ -2351,14 +2351,16 @@ function question_category_select_menu($contexts, $top = false, $currentcat = 0,
|
|||
global $OUTPUT;
|
||||
$categoriesarray = question_category_options($contexts, $top, $currentcat, false, $nochildrenof);
|
||||
if ($selected) {
|
||||
$nothing = '';
|
||||
$choose = '';
|
||||
} else {
|
||||
$nothing = 'choosedots';
|
||||
$choose = 'choosedots';
|
||||
}
|
||||
$select = html_select::make($categoriesarray, 'category', $selected);
|
||||
$select->nothingvalue = $nothing;
|
||||
$select->nested = true;
|
||||
echo $OUTPUT->select($select);
|
||||
$options = array();
|
||||
foreach($categoriesarray as $group=>$opts) {
|
||||
$options[] = array($group=>$opts);
|
||||
}
|
||||
|
||||
echo html_writer::select($options, 'category', $selected, $choose);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue