Skip to content

Commit cb40349

Browse files
committed
xml-edit - Output validation messages on importasversion
1 parent a8e0de1 commit cb40349

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

questiontype.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,18 @@ public function save_question_options($fromform) {
157157
}
158158
}
159159
break;
160-
// Ideally importasversion would handle notice/errors messages.
161-
// That would allow us to show validation messages in Gitsync
162-
// and when importing as new.
160+
case 'question-bank-importasversion-import':
161+
$throwexceptions = false;
162+
$result = new \StdClass();
163+
if (!empty($fromform->validationerrors)) {
164+
$result->notice = $fromform->validationerrors;
165+
$dashboardlink = new moodle_url('/question/type/stack/questiontestrun.php', ['questionid' => $fromform->id]);
166+
$result->notice = html_writer::link(
167+
$dashboardlink,
168+
$fromform->name
169+
) . '<br>' . $result->notice;
170+
}
171+
break;
163172
default:
164173
// Edit page and everything else should behave as before.
165174
$result = null;

0 commit comments

Comments
 (0)