]> _ Git - cubist_cms-back.git/commitdiff
wip #6937 @7
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 3 Jun 2024 12:33:23 +0000 (14:33 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 3 Jun 2024 12:33:23 +0000 (14:33 +0200)
src/app/Magic/Models/CubistMagicAbstractModel.php
src/app/Magic/Models/CubistMagicTranslatableModel.php
src/resources/views/edit.blade.php

index bf5c251fa74fd354cb69758eb0a19f0b0500d175..69447506b6753a0addc2ffb9a98783a02aead79f 100644 (file)
@@ -70,6 +70,8 @@ class CubistMagicAbstractModel extends Model implements HasMedia
     protected $_enableRevisionsButton = false;
     protected $_enableBulk = true;
 
+    protected $revisionEnabled = true;
+
     protected $_flushCacheOnSave = true;
 
     public $timestamps = true;
@@ -488,6 +490,7 @@ class CubistMagicAbstractModel extends Model implements HasMedia
         if ($this->_enableRevisions) {
             $ops[] = ReviseOperation::class;
         }
+        $this->revisionEnabled = $this->_enableRevisions;
         $ops = array_merge($ops, $this->_operations);
 
         foreach ($ops as $operation) {
index 6a6a91d1f2202b6085030e45a8ffec45ae8a9de8..9261d4501eca979741f66bc30dd84e65d73479a3 100644 (file)
@@ -66,9 +66,6 @@ class CubistMagicTranslatableModel extends CubistMagicAbstractModel
     public function getTranslations(string $key = null, array $allowedLocales = null): array
     {
         if ($key !== null) {
-            if (isset($this->_translations[$key])) {
-                return $this->_translations[$key];
-            }
 //            $measure_label = 'Get translation in ' . get_class($this);
 //            start_measure($measure_label);
             $this->guardAgainstNonTranslatableAttribute($key);
@@ -94,7 +91,6 @@ class CubistMagicTranslatableModel extends CubistMagicAbstractModel
                     return $value !== null && $value !== '';
                 });
             }
-            $this->_translations[$key] = $res;
 //            stop_measure($measure_label);
             return $res;
         }
index d92d863f767309c5184c04f3a9e7e1acf7c74d7c..defef0cbda9a2f538804916d623c29a99603bbfd 100644 (file)
                             <button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown"
                                     aria-haspopup="true" aria-expanded="false">
                                 {{trans('backpack::crud.language')}}
-                                : {{ $crud->model->getAvailableLocales()[request()->input('_locale')?request()->input('_locale'):App::getLocale()] }}
+                                : {{ $entry->getAvailableLocales()[request()->input('_locale')?request()->input('_locale'):App::getLocale()] }}
                                 &nbsp; <span class="caret"></span>
                             </button>
                             <ul class="dropdown-menu">
-                                @foreach ($crud->model->getAvailableLocales() as $key => $locale)
+                                @foreach ($entry->getAvailableLocales() as $key => $locale)
                                     <a class="dropdown-item"
                                        href="{{ url($crud->route.'/'.$entry->getKey().'/edit') }}?_locale={{ $key }}">{{ $locale }}</a>
                                 @endforeach