mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #5870 from open-sausages/pulls/4.0/move-NestedController
API Move NestedController from cms to framework
This commit is contained in:
commit
f79c11f7f8
@ -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;
|
||||||
|
19
control/NestedController.php
Normal file
19
control/NestedController.php
Normal 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();
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user