MDL-82767 mod_qbank: fix delete action url
This commit is contained in:
@@ -83,6 +83,15 @@ abstract class basecontrolmenu implements named_templatable, renderable {
|
||||
$this->baseurl = $format->get_view_url($format->get_sectionnum(), ['navigation' => true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the default base URL to return after each action.
|
||||
*
|
||||
* @param url $baseurl
|
||||
*/
|
||||
public function set_baseurl(url $baseurl) {
|
||||
$this->baseurl = $baseurl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export this data so it can be used as the context for a mustache template.
|
||||
*
|
||||
|
||||
@@ -19,6 +19,7 @@ namespace core_question\output;
|
||||
use action_link;
|
||||
use renderer_base;
|
||||
use core_courseformat\output\local\content\cm\controlmenu;
|
||||
use core_question\local\bank\question_bank_helper;
|
||||
|
||||
/**
|
||||
* Create a list of question bank type links to manage their respective instances.
|
||||
@@ -52,8 +53,10 @@ class question_bank_list implements \renderable, \templatable {
|
||||
$banks = [];
|
||||
foreach ($this->bankinstances as $instance) {
|
||||
if (plugin_supports('mod', $instance->cminfo->modname, FEATURE_PUBLISHES_QUESTIONS)) {
|
||||
$returnurl = question_bank_helper::get_url_for_qbank_list($instance->cminfo->course);
|
||||
$format = course_get_format($instance->cminfo->course);
|
||||
$controlmenu = new controlmenu($format, $instance->cminfo->get_section_info(), $instance->cminfo);
|
||||
$controlmenu->set_baseurl($returnurl);
|
||||
$actions = $controlmenu->get_cm_control_items();
|
||||
$actionmenu = new \action_menu();
|
||||
$actionmenu->set_kebab_trigger(get_string('edit'));
|
||||
|
||||
@@ -53,6 +53,6 @@ Feature: Manage question banks
|
||||
When I navigate to "Question banks" in current page administration
|
||||
And I open the action menu in "bank1" "list_item"
|
||||
And I choose "Delete" in the open action menu
|
||||
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
||||
And I click on "Delete" "button"
|
||||
Then I should not see "bank1"
|
||||
But I should see "bank2"
|
||||
|
||||
Reference in New Issue
Block a user