Commit 2f920d9b authored by Andrew Nicols's avatar Andrew Nicols

Merge branch 'wip-MDL-56864-master' of git://github.com/marinaglancy/moodle

parents 8cdfa869 077edd30
...@@ -244,7 +244,11 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete { ...@@ -244,7 +244,11 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete {
*/ */
public function exportValue(&$submitValues, $assoc = false) { public function exportValue(&$submitValues, $assoc = false) {
if (!$this->is_tagging_enabled()) { if (!$this->is_tagging_enabled()) {
return $assoc ? array($this->getName() => array()) : array(); return $this->_prepareValue([], $assoc);
}
if ($this->_findValue($submitValues) === '_qf__force_multiselect_submission') {
// Nothing was selected.
return $this->_prepareValue([], $assoc);
} }
return parent::exportValue($submitValues, $assoc); return parent::exportValue($submitValues, $assoc);
...@@ -257,6 +261,7 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete { ...@@ -257,6 +261,7 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete {
$url = new moodle_url('/tag/manage.php', array('tc' => $this->get_tag_collection())); $url = new moodle_url('/tag/manage.php', array('tc' => $this->get_tag_collection()));
$context['managestandardtagsurl'] = $url->out(false); $context['managestandardtagsurl'] = $url->out(false);
} }
$context['nameraw'] = $this->getName();
return $context; return $context;
} }
......
{{< core_form/element-template-inline }} {{< core_form/element-template-inline }}
{{$element}} {{$element}}
{{^element.frozen}} {{^element.frozen}}
<input type="hidden" name="{{element.nameraw}}" value="_qf__force_multiselect_submission">
<select class="custom-select {{#error}}form-control-danger{{/error}}" name="{{element.name}}" <select class="custom-select {{#error}}form-control-danger{{/error}}" name="{{element.name}}"
id="{{element.id}}" id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}} {{#element.multiple}}multiple{{/element.multiple}}
......
{{< core_form/element-template }} {{< core_form/element-template }}
{{$element}} {{$element}}
{{^element.frozen}} {{^element.frozen}}
<input type="hidden" name="{{element.nameraw}}" value="_qf__force_multiselect_submission">
<select class="custom-select {{#error}}form-control-danger{{/error}}" name="{{element.name}}" <select class="custom-select {{#error}}form-control-danger{{/error}}" name="{{element.name}}"
id="{{element.id}}" id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}} {{#element.multiple}}multiple{{/element.multiple}}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment