Skip to content

Commit

Permalink
Fix position to call setupSiteInterfaceLocalization function
Browse files Browse the repository at this point in the history
See discussion about this change: concretecms#7909
  • Loading branch information
hissy committed Jul 21, 2021
1 parent 0b62094 commit 9eff103
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions concrete/src/Http/ResponseFactory.php
Expand Up @@ -93,6 +93,8 @@ public function notFound($content, $code = Response::HTTP_NOT_FOUND, $headers =

if (is_object($c) && !$c->isError()) {
// Display not found
$dl = $this->app->make('multilingual/detector');
$dl->setupSiteInterfaceLocalization($c);
$this->request->setCurrentPage($c);

return $this->controller($c->getPageController(), $code, $headers);
Expand Down Expand Up @@ -122,6 +124,8 @@ public function forbidden($requestUrl, $code = Response::HTTP_FORBIDDEN, $header
$item = '/page_forbidden';
$c = Page::getByPath($item);
if (is_object($c) && !$c->isError()) {
$dl = $this->app->make('multilingual/detector');
$dl->setupSiteInterfaceLocalization($c);
$this->request->setCurrentPage($c);

return $this->controller($c->getPageController(), $code, $headers);
Expand Down Expand Up @@ -229,8 +233,6 @@ public function collection(Collection $collection, $code = Response::HTTP_OK, $h
}

$dl = $this->app->make('multilingual/detector');
$dl->setupSiteInterfaceLocalization($collection);

$request = $this->request;

if ($collection->isError() && $collection->getError() == COLLECTION_NOT_FOUND) {
Expand Down Expand Up @@ -259,6 +261,7 @@ public function collection(Collection $collection, $code = Response::HTTP_OK, $h
if ($smm == 1 && !Key::getByHandle('view_in_maintenance_mode')->validate() && ($_SERVER['REQUEST_METHOD'] != 'POST' || $this->app->make('token')->validate() == false)) {
$v = new View('/frontend/maintenance_mode');
$v->addScopeItems(['c' => $collection]);
$dl->setupSiteInterfaceLocalization($collection);
$request->setCurrentPage($collection);

return $this->view($v, $code, $headers);
Expand Down Expand Up @@ -339,6 +342,7 @@ public function collection(Collection $collection, $code = Response::HTTP_OK, $h
}
}

$dl->setupSiteInterfaceLocalization($collection);
$request->setCurrentPage($collection);
$c = $collection; // process.php needs this
require DIR_BASE_CORE . '/bootstrap/process.php';
Expand Down

0 comments on commit 9eff103

Please sign in to comment.