API Move NestedController from cms to framework

This commit is contained in:
Damian Mooyman 2016-08-05 10:55:41 +12:00
parent 2ea65e9064
commit 1c3ec19353
No known key found for this signature in database
GPG Key ID: 78B823A10DE27D1A
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'])) {
$formController = Director::getControllerForURL($this->requestParams['formController']);
while(is_a($formController, 'NestedController')) {
while ($formController instanceof NestedController) {
$formController = $formController->getNestedController();
}
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();
}