Permalink
Browse files

ENHANCEMENT: Provide a default Controller::Link() method, meaning tha…

…t Controller objects can be constructed to help with testing forms.
  • Loading branch information...
1 parent 9436ecb commit 06605ffadc8b0126731af43eaa5502389d1f2a33 @sminnee sminnee committed Jan 10, 2012
Showing with 8 additions and 1 deletion.
  1. +7 −0 control/Controller.php
  2. +1 −1 security/Security.php
View
@@ -84,6 +84,13 @@ function init() {
$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.
*
View
@@ -297,7 +297,7 @@ protected function GetLoginForms()
* @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";
}

0 comments on commit 06605ff

Please sign in to comment.