MDL-74808 question: only add title attr if tooltip is set

This commit is contained in:
Simey Lameze
2022-07-08 14:38:04 +08:00
parent fe7c20d157
commit f62ae260f4
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -58,7 +58,7 @@
{{/params}}
<button type="submit" class="btn {{#primary}}btn-primary{{/primary}}{{^primary}}btn-secondary{{/primary}}"
id="{{id}}"
title="{{tooltip}}"
{{#tooltip}}title="{{tooltip}}"{{/tooltip}}
{{#disabled}}disabled{{/disabled}}
{{#attributes}} {{name}}="{{value}}" {{/attributes}}>{{label}}</button>
</form>
@@ -78,9 +78,13 @@ class editquestion_helper {
if ($canadd) {
$params['category'] = $categoryid;
$url = new \moodle_url('/question/bank/editquestion/addquestion.php', $params);
$buttonparams = ['disabled' => $disabled];
if (!empty($tooltip)) {
$buttonparams['title'] = $tooltip;
}
$addquestiondisplay['buttonhtml'] = $OUTPUT->single_button($url,
get_string('createnewquestion', 'question'),
'get', array('disabled' => $disabled, 'title' => $tooltip));
'get', $buttonparams);
$addquestiondisplay['qtypeform'] = self::print_choose_qtype_to_add_form(array());
}
return $PAGE->get_renderer('qbank_editquestion')->render_create_new_question_button($addquestiondisplay);