Merge pull request #5870 from open-sausages/pulls/4.0/move-NestedController

API Move NestedController from cms to framework
This commit is contained in:
Hamish Friedlander 2016-08-05 11:23:34 +12:00 committed by GitHub
commit f79c11f7f8
2 changed files with 20 additions and 1 deletions

View File

@ -363,7 +363,7 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
if(isset($this->requestParams['formController'])) { if(isset($this->requestParams['formController'])) {
$formController = Director::getControllerForURL($this->requestParams['formController']); $formController = Director::getControllerForURL($this->requestParams['formController']);
while(is_a($formController, 'NestedController')) { while ($formController instanceof NestedController) {
$formController = $formController->getNestedController(); $formController = $formController->getNestedController();
} }
return $formController; return $formController;

View File

@ -0,0 +1,19 @@
<?php
/**
* Interface that is implemented by controllers that are designed to hand control over to another controller.
* ModelAsController, which selects up a SiteTree object and passes control over to a suitable subclass of ContentController, is a good
* example of this.
*
* Controllers that implement this interface must always return a nested controller.
*/
interface NestedController {
/**
* Get overriding controller
*
* @return Controller
*/
public function getNestedController();
}