From 4f01c8887162ebf2fa566b5ab89c87bcd52ac032 Mon Sep 17 00:00:00 2001 From: roadiz-ci Date: Mon, 26 Aug 2024 10:32:04 +0000 Subject: [PATCH] Merge branch hotfix/v2.3.25 --- config/services.yaml | 2 +- src/Api/Controller/GetWebResponseByPathController.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config/services.yaml b/config/services.yaml index 023e9ae4..d7dc9c72 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -1,6 +1,6 @@ --- parameters: - roadiz_core.cms_version: '2.3.24' + roadiz_core.cms_version: '2.3.25' roadiz_core.cms_version_prefix: 'main' env(APP_NAMESPACE): "roadiz" env(APP_VERSION): "0.1.0" diff --git a/src/Api/Controller/GetWebResponseByPathController.php b/src/Api/Controller/GetWebResponseByPathController.php index 2e924a4f..b6434889 100644 --- a/src/Api/Controller/GetWebResponseByPathController.php +++ b/src/Api/Controller/GetWebResponseByPathController.php @@ -134,6 +134,15 @@ protected function normalizeResourcePath(?Request $request, string $path): Persi $this->addResourceToCacheTags($request, $resource); + // Set translation and locale to be used in Request context + if (null !== $resourceInfo->getTranslation()) { + $request->attributes->set('_translation', $resourceInfo->getTranslation()); + } + + if (null !== $resourceInfo->getLocale()) { + $request->attributes->set('_locale', $resourceInfo->getLocale()); + } + /* * Or plain entity */