mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #2099 from creative-commoners/pulls/4.0/dont-alias-this
MINOR Stop aliasing $this in history controller callbacks
This commit is contained in:
commit
9d77d32dea
@ -57,18 +57,19 @@ class CMSPageHistoryController extends CMSMain
|
|||||||
public function getResponseNegotiator()
|
public function getResponseNegotiator()
|
||||||
{
|
{
|
||||||
$negotiator = parent::getResponseNegotiator();
|
$negotiator = parent::getResponseNegotiator();
|
||||||
$controller = $this;
|
|
||||||
$negotiator->setCallback('CurrentForm', function () use (&$controller) {
|
$negotiator->setCallback('CurrentForm', function () {
|
||||||
$form = $controller->getEditForm();
|
$form = $this->getEditForm();
|
||||||
if ($form) {
|
if ($form) {
|
||||||
return $form->forTemplate();
|
return $form->forTemplate();
|
||||||
} else {
|
|
||||||
return $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
|
|
||||||
}
|
}
|
||||||
|
return $this->renderWith($this->getTemplatesWithSuffix('_Content'));
|
||||||
});
|
});
|
||||||
$negotiator->setCallback('default', function () use (&$controller) {
|
|
||||||
return $controller->renderWith($controller->getViewer('show'));
|
$negotiator->setCallback('default', function () {
|
||||||
|
return $this->renderWith($this->getViewer('show'));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $negotiator;
|
return $negotiator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,16 +89,15 @@ class CMSPageHistoryController extends CMSMain
|
|||||||
$form = $this->getEditForm();
|
$form = $this->getEditForm();
|
||||||
|
|
||||||
$negotiator = $this->getResponseNegotiator();
|
$negotiator = $this->getResponseNegotiator();
|
||||||
$controller = $this;
|
$negotiator->setCallback('CurrentForm', function () use ($form) {
|
||||||
$negotiator->setCallback('CurrentForm', function () use (&$controller, &$form) {
|
|
||||||
return $form
|
return $form
|
||||||
? $form->forTemplate()
|
? $form->forTemplate()
|
||||||
: $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
|
: $this->renderWith($this->getTemplatesWithSuffix('_Content'));
|
||||||
});
|
});
|
||||||
$negotiator->setCallback('default', function () use (&$controller, &$form) {
|
$negotiator->setCallback('default', function () use ($form) {
|
||||||
return $controller
|
return $this
|
||||||
->customise(array('EditForm' => $form))
|
->customise(array('EditForm' => $form))
|
||||||
->renderWith($controller->getViewer('show'));
|
->renderWith($this->getViewer('show'));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $negotiator->respond($request);
|
return $negotiator->respond($request);
|
||||||
@ -115,12 +115,11 @@ class CMSPageHistoryController extends CMSMain
|
|||||||
);
|
);
|
||||||
|
|
||||||
$negotiator = $this->getResponseNegotiator();
|
$negotiator = $this->getResponseNegotiator();
|
||||||
$controller = $this;
|
$negotiator->setCallback('CurrentForm', function () use ($form) {
|
||||||
$negotiator->setCallback('CurrentForm', function () use (&$controller, &$form) {
|
return $form ? $form->forTemplate() : $this->renderWith($this->getTemplatesWithSuffix('_Content'));
|
||||||
return $form ? $form->forTemplate() : $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
|
|
||||||
});
|
});
|
||||||
$negotiator->setCallback('default', function () use (&$controller, &$form) {
|
$negotiator->setCallback('default', function () use ($form) {
|
||||||
return $controller->customise(array('EditForm' => $form))->renderWith($controller->getViewer('show'));
|
return $this->customise(array('EditForm' => $form))->renderWith($this->getViewer('show'));
|
||||||
});
|
});
|
||||||
|
|
||||||
return $negotiator->respond($request);
|
return $negotiator->respond($request);
|
||||||
|
Loading…
Reference in New Issue
Block a user