From 7cad1cb10313117a8664ba7932c02a04676a3402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Ste=CC=A8pien=CC=81?= Date: Sat, 16 Nov 2024 13:24:24 +0100 Subject: [PATCH] Fix: product customization fix --- src/Core/ListingDisplay/ThemeListDisplay.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Core/ListingDisplay/ThemeListDisplay.php b/src/Core/ListingDisplay/ThemeListDisplay.php index d017e66..54f8700 100644 --- a/src/Core/ListingDisplay/ThemeListDisplay.php +++ b/src/Core/ListingDisplay/ThemeListDisplay.php @@ -15,7 +15,16 @@ class ThemeListDisplay 'list', ]; - public function setDisplay($display) + protected function getRequest(): Request + { + Request::setFactory(static function ($query, $request, $attributes, $cookies, $files, $server, $content) { + return new Request($query, $request, $attributes, $cookies, [], $server, $content); + }); + + return Request::createFromGlobals(); + } + + public function setDisplay($display): Response { if (!in_array($display, $this->displayList)) { $display = \Configuration::get(GeneralConfiguration::THEMECORE_DISPLAY_LIST); @@ -35,7 +44,7 @@ public function setDisplay($display) public function getDisplay() { - $displayFromCookie = Request::createFromGlobals()->cookies->get($this->cookieName); + $displayFromCookie = $this->getRequest()->cookies->get($this->cookieName); if ($displayFromCookie) { return $displayFromCookie;