BUG Remove duplicate extension hook

Fixes #5170
Reverts #3355
This commit is contained in:
Damian Mooyman 2016-03-14 08:36:47 +13:00
parent 5d3b896297
commit 7769f03ccc
2 changed files with 16 additions and 5 deletions

View File

@ -197,8 +197,6 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
* @return HTMLText|SS_HTTPResponse * @return HTMLText|SS_HTTPResponse
*/ */
protected function handleAction($request, $action) { protected function handleAction($request, $action) {
$this->extend('beforeCallActionHandler', $request, $action);
foreach($request->latestParams() as $k => $v) { foreach($request->latestParams() as $k => $v) {
if($v || !isset($this->urlParams[$k])) $this->urlParams[$k] = $v; if($v || !isset($this->urlParams[$k])) $this->urlParams[$k] = $v;
} }
@ -215,9 +213,22 @@ class Controller extends RequestHandler implements TemplateGlobalProvider {
} else { } else {
return $result; return $result;
} }
} else {
return $this->getViewer($action)->process($this);
} }
// Fall back to index action with before/after handlers
$beforeResult = $this->extend('beforeCallActionHandler', $request, $action);
if ($beforeResult) {
return reset($beforeResult);
}
$result = $this->getViewer($action)->process($this);
$afterResult = $this->extend('afterCallActionHandler', $request, $action, $result);
if($afterResult) {
return reset($afterResult);
}
return $result;
} }
/** /**

View File

@ -287,7 +287,7 @@ class RequestHandler extends ViewableData {
$actionRes = $this->$action($request); $actionRes = $this->$action($request);
$res = $this->extend('afterCallActionHandler', $request, $action); $res = $this->extend('afterCallActionHandler', $request, $action, $actionRes);
if ($res) return reset($res); if ($res) return reset($res);
return $actionRes; return $actionRes;