]> _ Git - cubist_cms-back.git/commitdiff
wip #5772 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Mar 2023 21:28:39 +0000 (22:28 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Mar 2023 21:28:39 +0000 (22:28 +0100)
src/app/Magic/Fields/Field.php
src/app/Magic/Fields/StandardFile.php

index d6c7d6610a23b77ab3c20e735388860b9574c9d2..d31a0fdb7b16e4d837072589c6c05104a7f5594e 100644 (file)
@@ -193,10 +193,14 @@ class Field implements \ArrayAccess
     {
         $this->_preGetDefinition();
         $res = $this->_attributes;
-        if ($this->getAttribute('read_only', false)) {
+        if ($this->getAttribute('read_only', false) && $res['type'] !== 'hidden') {
             $res['view_namespace'] = CubistBackpackServiceProvider::NAMESPACE . '::fields';
             $res['type'] = 'static_value';
         }
+        if($this->getAttribute('hidden',false)){
+            $res['view_namespace'] = 'crud::fields';
+            $res['type'] = 'hidden';
+        }
         $res['attributes'] = $this->getFieldAttributes();
         return $res;
     }
index d1d7b5105c625ebcff648225b165fc2f0e11a4d5..4f74ad7df4c524995cc530b0c0c8e656526899d0 100644 (file)
@@ -8,11 +8,24 @@ class StandardFile extends Field
     protected $_adminType = 'upload';
     protected $_disk = 'uploads';
 
+    protected $_multiple = false;
+
     protected function getFieldAttributes()
     {
         $res = parent::getFieldAttributes();
         $res['upload'] = true;
         $res['disk'] = $this->_disk;
+        $res['multiple'] = $this->_multiple;
         return $res;
     }
+
+    protected function _postSetAttributes()
+    {
+        parent::_postSetAttributes();
+        if ($this->getAttribute('multiple', false)) {
+            $this->_adminType = 'upload_multiple';
+        } else {
+            $this->_adminType = 'upload';
+        }
+    }
 }