MDL-71614 qbank_previewquestion: Add Preview question plugin to core
This implementation will introduce a qbank plugin "previewquestion" which will view the preview question action in the question bank actions by replacing the core classes, scripts and yui modules. This plugin will also replace the preview option in the edit question form. Having this plugin will give users the flexibility of enabling or disabling this feature from the question bank view. This change will also allow other qbank plugins to add elements or information in the preview question page by implementing a callback. It also changes the pop up to page redirect from base view page to make sure any changes in preview reflects in the base view, for example, comments added and the number of comments in the comments colum changes while back from the preview page. Other locations like edit and qtype plugins where the preview is implemented, stays the same. Co-Authored-By: Guillermo Gomez Arias <[email protected]> Co-Authored-By: Safat Shahin <[email protected]>
This commit is contained in:
co-authored by
Guillermo Gomez Arias
parent
443a980aea
commit
0d55b26da8
@@ -48,24 +48,19 @@ class core_question_renderer extends plugin_renderer_base {
|
||||
* Must be a course or category context.
|
||||
* @param bool $showlabel if true, show the word 'Preview' after the icon.
|
||||
* If false, just show the icon.
|
||||
* @deprecated since Moodle 4.0
|
||||
* @see qbank_previewquestion\output\renderer
|
||||
* @todo MDL-71679 uncomment the debugging message after implementing the changes in mod_quiz
|
||||
* @todo Final deprecation on Moodle 4.4 MDL-72438
|
||||
*/
|
||||
public function question_preview_link($questionid, context $context, $showlabel) {
|
||||
if ($showlabel) {
|
||||
$alt = '';
|
||||
$label = get_string('preview');
|
||||
$attributes = array();
|
||||
} else {
|
||||
$alt = get_string('preview');
|
||||
$label = '';
|
||||
$attributes = array('title' => $alt);
|
||||
}
|
||||
// Debugging message will be re-added after implementing the changes in mod_quiz.
|
||||
// ...debugging('Function question_preview_link() has been deprecated and moved to qbank_previewquestion plugin,
|
||||
// Please use qbank_previewquestion renderer.', DEBUG_DEVELOPER);.
|
||||
|
||||
$image = $this->pix_icon('t/preview', $alt, '', array('class' => 'iconsmall'));
|
||||
$link = question_preview_url($questionid, null, null, null, null, $context);
|
||||
$action = new popup_action('click', $link, 'questionpreview',
|
||||
question_preview_popup_params());
|
||||
|
||||
return $this->action_link($link, $image . $label, $action, $attributes);
|
||||
return $this->page->get_renderer('qbank_previewquestion')->question_preview_link(
|
||||
$questionid, $context, $showlabel
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user