From 06605ffadc8b0126731af43eaa5502389d1f2a33 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 10 Jan 2012 16:23:42 +1300 Subject: [PATCH] ENHANCEMENT: Provide a default Controller::Link() method, meaning that Controller objects can be constructed to help with testing forms. --- control/Controller.php | 7 +++++++ security/Security.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/control/Controller.php b/control/Controller.php index ee2d9e8bd..1c1975347 100644 --- a/control/Controller.php +++ b/control/Controller.php @@ -84,6 +84,13 @@ class Controller extends RequestHandler { $this->baseInitCalled = true; } + /** + * Returns a link to this controller. Overload with your own Link rules if they exist. + */ + function Link() { + return get_class($this) .'/'; + } + /** * Executes this controller, and return an {@link SS_HTTPResponse} object with the result. * diff --git a/security/Security.php b/security/Security.php index 74acb4982..657f00c48 100644 --- a/security/Security.php +++ b/security/Security.php @@ -297,7 +297,7 @@ class Security extends Controller { * @param string $action Name of the action * @return string Returns the link to the given action */ - public static function Link($action = null) { + public function Link($action = null) { return "Security/$action"; }