From 863fb96ffa5aa18a7ae6c920216370d7e6dc2d2d Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 28 Apr 2020 21:13:41 +0100 Subject: [PATCH] MDL-56595 tool_usertours: set page params when configuring tours/steps. --- admin/tool/usertours/classes/manager.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/admin/tool/usertours/classes/manager.php b/admin/tool/usertours/classes/manager.php index 4a9f5cf48ea..6741568b0b5 100644 --- a/admin/tool/usertours/classes/manager.php +++ b/admin/tool/usertours/classes/manager.php @@ -138,13 +138,28 @@ class manager { */ const CONFIG_SHIPPED_VERSION = 'shipped_version'; + /** + * Helper method to initialize admin page, setting appropriate extra URL parameters + * + * @param string $action + */ + protected function setup_admin_externalpage(string $action): void { + admin_externalpage_setup('tool_usertours/tours', '', array_filter([ + 'action' => $action, + 'id' => optional_param('id', 0, PARAM_INT), + 'tourid' => optional_param('tourid', 0, PARAM_INT), + 'direction' => optional_param('direction', 0, PARAM_INT), + ])); + } + /** * This is the entry point for this controller class. * * @param string $action The action to perform. */ public function execute($action) { - admin_externalpage_setup('tool_usertours/tours'); + $this->setup_admin_externalpage($action); + // Add the main content. switch($action) { case self::ACTION_NEWTOUR: -- 2.43.0