mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #194 from openclassify/dia
better way to get language from the request
This commit is contained in:
commit
4305e7dfbd
@ -14,7 +14,11 @@
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-xs-3">
|
||||
<div class="card m-4">
|
||||
<img src="{{ store.file.url }}" class="card-img-top">
|
||||
{% if store.file is null %}
|
||||
<img src="{{ img('visiosoft.theme.base::images/no-image.png').url }}" class="card-img-top">
|
||||
{% else %}
|
||||
<img src="{{ store.file.url }}" class="card-img-top">
|
||||
{% endif %}
|
||||
<div class="card-body">
|
||||
<h5 class="card-title text-center mb-0">{{ store.name }}</h5>
|
||||
</div>
|
||||
|
||||
@ -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") {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user