From 72a3d05b7e287f7dfe3ccb726558cc362fc82da7 Mon Sep 17 00:00:00 2001 From: Ryan Wyllie Date: Fri, 8 Mar 2019 14:51:31 +0800 Subject: [PATCH] MDL-64820 portfolio: add url return for portfolio_add_button to_html --- lib/portfolio/constants.php | 6 ++++++ lib/portfoliolib.php | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/lib/portfolio/constants.php b/lib/portfolio/constants.php index 04e59656c53..0b620143a53 100644 --- a/lib/portfolio/constants.php +++ b/lib/portfolio/constants.php @@ -200,3 +200,9 @@ define('PORTFOLIO_ADD_TEXT_LINK', 4); * this replaces the old portfolio_fake_add_url function */ define('PORTFOLIO_ADD_FAKE_URL', 5); + +/** + * PORTFOLIO_ADD_MOODULE_URL - hacky way to turn the button class into a moodle_url to redirect to + * this replaces the old portfolio_fake_add_url function + */ +define('PORTFOLIO_ADD_MOODLE_URL', 6); diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index 68fcf860f0a..37d5efeb570 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -327,6 +327,11 @@ class portfolio_add_button { return; } } + // If we just want a moodle_url to redirect to, do it now. + if ($format == PORTFOLIO_ADD_MOODLE_URL) { + return $url; + } + // if we just want a url to redirect to, do it now if ($format == PORTFOLIO_ADD_FAKE_URL) { return $url->out(false);