From 4509be229621176b9d80c9c3615320ef48a17fa4 Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Thu, 22 Feb 2018 09:44:15 +0800 Subject: [PATCH] MDL-61444 question: freeze element for users without caps --- question/type/edit_question_form.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/question/type/edit_question_form.php b/question/type/edit_question_form.php index bdc48a96f74..dd3be4b467e 100644 --- a/question/type/edit_question_form.php +++ b/question/type/edit_question_form.php @@ -201,13 +201,16 @@ abstract class question_edit_form extends question_wizard_form { // Any questiontype specific fields. $this->definition_inner($mform); - if (core_tag_tag::is_enabled('core_question', 'question') - && question_has_capability_on($this->question, 'tag')) { + if (core_tag_tag::is_enabled('core_question', 'question')) { $mform->addElement('header', 'tagsheader', get_string('tags')); - } - $mform->addElement('tags', 'tags', get_string('tags'), + $mform->addElement('tags', 'tags', get_string('tags'), array('itemtype' => 'question', 'component' => 'core_question')); + if (!question_has_capability_on($this->question, 'tag')) { + $mform->freeze('tags'); + } + } + if (!empty($this->question->id)) { $mform->addElement('header', 'createdmodifiedheader', get_string('createdmodifiedheader', 'question'));