diff --git a/changelog.md b/changelog.md index 0e9e558..eb30e05 100644 --- a/changelog.md +++ b/changelog.md @@ -27,4 +27,5 @@ Minor update to: # 1.1.1 -* Allow setting of password restrictions on registration \ No newline at end of file +* Allow setting of password restrictions on registration +* Add out of the box support for ContentController::getMenu \ No newline at end of file diff --git a/code/control/Users_Account_Controller.php b/code/control/Users_Account_Controller.php index 1687ba6..974fbbb 100755 --- a/code/control/Users_Account_Controller.php +++ b/code/control/Users_Account_Controller.php @@ -133,6 +133,24 @@ public function RelativeLink($action = null) ); } + /** + * If content controller exists, return it's menu function + * @param int $level Menu level to return. + * @return ArrayList + */ + public function getMenu($level = 1) + { + if (class_exists(ContentController::class)) { + $controller = Injector::inst()->get(ContentController::class); + return $controller->getMenu($level); + } + } + + public function Menu($level) + { + return $this->getMenu(); + } + /** * Display the currently outstanding orders for the current user * diff --git a/code/control/Users_Register_Controller.php b/code/control/Users_Register_Controller.php index 5330d07..a5d9460 100755 --- a/code/control/Users_Register_Controller.php +++ b/code/control/Users_Register_Controller.php @@ -88,6 +88,24 @@ public function RelativeLink($action = null) ); } + /** + * If content controller exists, return it's menu function + * @param int $level Menu level to return. + * @return ArrayList + */ + public function getMenu($level = 1) + { + if (class_exists(ContentController::class)) { + $controller = Injector::inst()->get(ContentController::class); + return $controller->getMenu($level); + } + } + + public function Menu($level) + { + return $this->getMenu(); + } + /** * Default action this controller will deal with *