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