Tabs to spaces in Controller

This commit is contained in:
Robbie Averill 2017-01-26 08:25:53 +13:00
parent ec9421ba65
commit 8dae0a6f95

View File

@ -55,35 +55,35 @@ class WidgetController extends Controller
parent::__construct(); parent::__construct();
} }
/** /**
* @param string $action * @param string $action
* @return string * @return string
*/ */
public function Link($action = null) public function Link($action = null)
{ {
$id = ($this->widget) ? $this->widget->ID : null; $id = ($this->widget) ? $this->widget->ID : null;
$segment = Controller::join_links('widget', $id, $action); $segment = Controller::join_links('widget', $id, $action);
$page = Director::get_current_page(); $page = Director::get_current_page();
if ($page && !($page instanceof WidgetController)) { if ($page && !($page instanceof WidgetController)) {
return $page->Link($segment); return $page->Link($segment);
} }
if ($controller = $this->getParentController()) { if ($controller = $this->getParentController()) {
return $controller->Link($segment); return $controller->Link($segment);
} }
return $segment; return $segment;
} }
/** /**
* Cycles up the controller stack until it finds a non-widget controller * Cycles up the controller stack until it finds a non-widget controller
* This is needed becauseController::currreturns the widget controller, * This is needed becauseController::currreturns the widget controller,
* which means anyLinkfunction turns into endless loop. * which means anyLinkfunction turns into endless loop.
* *
* @return Controller * @return Controller
*/ */
public function getParentController() public function getParentController()
{ {
foreach (Controller::$controller_stack as $controller) { foreach (Controller::$controller_stack as $controller) {
if (!($controller instanceof WidgetController)) { if (!($controller instanceof WidgetController)) {
@ -93,45 +93,45 @@ class WidgetController extends Controller
return false; return false;
} }
/** /**
* @return Widget * @return Widget
*/ */
public function getWidget() public function getWidget()
{ {
return $this->widget; return $this->widget;
} }
/** /**
* Overloaded from {@link Widget->Content()} to allow for controller / form * Overloaded from {@link Widget->Content()} to allow for controller / form
* linking. * linking.
* *
* @return string HTML * @return string HTML
*/ */
public function Content() public function Content()
{ {
return $this->renderWith(array_reverse(ClassInfo::ancestry($this->widget->class))); return $this->renderWith(array_reverse(ClassInfo::ancestry($this->widget->class)));
} }
/** /**
* Overloaded from {@link Widget->WidgetHolder()} to allow for controller/ * Overloaded from {@link Widget->WidgetHolder()} to allow for controller/
* form linking. * form linking.
* *
* @return string HTML * @return string HTML
*/ */
public function WidgetHolder() public function WidgetHolder()
{ {
return $this->renderWith("WidgetHolder"); return $this->renderWith("WidgetHolder");
} }
/** /**
* Uses the `WidgetEditor.ss` template and {@link Widget->editablesegment()} * Uses the `WidgetEditor.ss` template and {@link Widget->editablesegment()}
* to render a administrator-view of the widget. It is assumed that this * to render a administrator-view of the widget. It is assumed that this
* view contains form elements which are submitted and saved through * view contains form elements which are submitted and saved through
* {@link WidgetAreaEditor} within the CMS interface. * {@link WidgetAreaEditor} within the CMS interface.
* *
* @return string HTML * @return string HTML
*/ */
public function editablesegment() public function editablesegment()
{ {
// use left and main to set the html config // use left and main to set the html config
$leftandmain = LeftAndMain::create(); $leftandmain = LeftAndMain::create();