Skip to content

Commit

Permalink
Merge pull request #5870 from open-sausages/pulls/4.0/move-NestedCont…
Browse files Browse the repository at this point in the history
…roller

API Move NestedController from cms to framework
  • Loading branch information
Hamish Friedlander committed Aug 4, 2016
2 parents 2ea65e9 + 1c3ec19 commit f79c11f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion control/Controller.php
Expand Up @@ -363,7 +363,7 @@ public function getFormOwner() {
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;
Expand Down
19 changes: 19 additions & 0 deletions control/NestedController.php
@@ -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();

}

0 comments on commit f79c11f

Please sign in to comment.