BUGFIX: Use Director::get_current_page() rather than Controller::curr() in Widget_Controller->Link() to avoid infinite loops when the widget controller is handling a request.

From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90978 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew Short 2009-11-08 21:53:57 +00:00 committed by Sam Minnee
parent a8e96ef3f0
commit 5ba3a91741

View File

@ -155,9 +155,13 @@ class Widget_Controller extends Controller {
}
public function Link($action = null) {
return Controller::curr()->Link (
Controller::join_links('widget', ($this->widget ? $this->widget->ID : null), $action)
);
$segment = Controller::join_links('widget', ($this->widget ? $this->widget->ID : null), $action);
if(Director::get_current_page()) {
return Director::get_current_page()->Link($segment);
} else {
return Controller::curr()->Link($segment);
}
}
/**