Skip to content

Commit

Permalink
Support ContentController::getMenu (if CMS is installed)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewis-everley committed Feb 22, 2018
1 parent 09ec5d0 commit 553b9e9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ Minor update to:

# 1.1.1

* Allow setting of password restrictions on registration
* Allow setting of password restrictions on registration
* Add out of the box support for ContentController::getMenu
18 changes: 18 additions & 0 deletions code/control/Users_Account_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
18 changes: 18 additions & 0 deletions code/control/Users_Register_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down

0 comments on commit 553b9e9

Please sign in to comment.