MDL-55215 forms: Pass options and correctly merge choices

This commit is contained in:
Damyon Wiese
2016-10-28 13:23:48 +08:00
parent f7ed5cee30
commit e2c8fb8515
+4 -3
View File
@@ -44,11 +44,12 @@ class MoodleQuickForm_searchableselector extends MoodleQuickForm_autocomplete {
*
* @param string $elementname Element name
* @param mixed $elementlabel Label(s) for an element
* @param array $choices List of valid choices for the select.
* @param array $options List of valid options for the select.
*/
public function __construct($elementname = null, $elementlabel = null, $options = array()) {
$options = ['' => get_string('noselection', 'form')];
parent::__construct($elementname, $elementlabel, $options);
public function __construct($elementname = null, $elementlabel = null, $choices = array(), $options = array()) {
$choices = array_merge(['' => get_string('noselection', 'form')], $choices);
parent::__construct($elementname, $elementlabel, $choices, $options);
}
/**