ENHANCEMENT: Provide a default Controller::Link() method, meaning that Controller objects can be constructed to help with testing forms.

This commit is contained in:
Sam Minnee 2012-01-10 16:23:42 +13:00
parent 9436ecb1ce
commit 06605ffadc
2 changed files with 8 additions and 1 deletions

View File

@ -84,6 +84,13 @@ class Controller extends RequestHandler {
$this->baseInitCalled = true; $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. * Executes this controller, and return an {@link SS_HTTPResponse} object with the result.
* *

View File

@ -297,7 +297,7 @@ class Security extends Controller {
* @param string $action Name of the action * @param string $action Name of the action
* @return string Returns the link to the given action * @return string Returns the link to the given action
*/ */
public static function Link($action = null) { public function Link($action = null) {
return "Security/$action"; return "Security/$action";
} }