From 077edd303836b990b7badf8e9a72015451177ae5 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Tue, 21 Nov 2017 15:19:44 +0800 Subject: [PATCH] MDL-56864 forms: allow to remove last tag with forced standard tags --- lib/form/tags.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/form/tags.php b/lib/form/tags.php index 390c723ed58..ef3719f9433 100644 --- a/lib/form/tags.php +++ b/lib/form/tags.php @@ -244,7 +244,11 @@ class MoodleQuickForm_tags extends MoodleQuickForm_autocomplete { */ public function exportValue(&$submitValues, $assoc = false) { 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); -- 2.11.4.GIT