From c7b214c6cd3bf46d777c8e4c2c2de63a8de851f1 Mon Sep 17 00:00:00 2001 From: Diatrex Date: Tue, 31 Dec 2019 16:44:55 +0300 Subject: [PATCH 1/2] better way to get language from the request --- .../Controller/Admin/CategoryController.php | 27 +------------------ 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/addons/default/visiosoft/cats-module/src/Http/Controller/Admin/CategoryController.php b/addons/default/visiosoft/cats-module/src/Http/Controller/Admin/CategoryController.php index b591cf89b..8e6ee1829 100644 --- a/addons/default/visiosoft/cats-module/src/Http/Controller/Admin/CategoryController.php +++ b/addons/default/visiosoft/cats-module/src/Http/Controller/Admin/CategoryController.php @@ -71,7 +71,7 @@ class CategoryController extends AdminController return $this->redirect->back(); } - $locale = $this->getRequestLang($all); + $locale = config('streams::locales.enabled'); $translatable = array(); foreach ($all as $key => $value) { @@ -171,31 +171,6 @@ class CategoryController extends AdminController return substr_compare($string, $test, $strlen - $testlen, $testlen) === 0; } - public function getRequestLang($request) { - $locale = array(); - foreach ($request as $key => $field) { - $locale[] = substr($key, 0, -2); - } - $notTrans = array(); - $trans = array(); - foreach ($locale as $translatable) { - if (!in_array($translatable, $notTrans)) { - $notTrans[] = $translatable; - } else { - $trans[] = $translatable; - } - } - $locale = array(); - foreach ($request as $key => $field) { - foreach (array_unique($trans) as $entry) { - if (strpos($key, $entry) === 0) { - $locale[] = substr($key, -2); - } - } - } - return $locale; - } - public function edit(CategoryFormBuilder $form, Request $request, $id) { if ($request->action == "update") { From db38cc2d15104e652d89332363da3bdcf802ede9 Mon Sep 17 00:00:00 2001 From: Diatrex Date: Tue, 31 Dec 2019 17:05:29 +0300 Subject: [PATCH 2/2] better way to get language from the request --- .../resources/views/list/partials/user-section.twig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/default/visiosoft/advs-module/resources/views/list/partials/user-section.twig b/addons/default/visiosoft/advs-module/resources/views/list/partials/user-section.twig index 01f105bf1..7ee42f61d 100644 --- a/addons/default/visiosoft/advs-module/resources/views/list/partials/user-section.twig +++ b/addons/default/visiosoft/advs-module/resources/views/list/partials/user-section.twig @@ -14,7 +14,11 @@
- + {% if store.file is null %} + + {% else %} + + {% endif %}
{{ store.name }}