From: Vincent Vanwaelscappel Date: Thu, 2 Mar 2023 21:28:39 +0000 (+0100) Subject: wip #5772 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=d07c79f1b1aa330a350efc72ab2472f447801dfa;p=cubist_cms-back.git wip #5772 @0.5 --- diff --git a/src/app/Magic/Fields/Field.php b/src/app/Magic/Fields/Field.php index d6c7d66..d31a0fd 100644 --- a/src/app/Magic/Fields/Field.php +++ b/src/app/Magic/Fields/Field.php @@ -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; } diff --git a/src/app/Magic/Fields/StandardFile.php b/src/app/Magic/Fields/StandardFile.php index d1d7b51..4f74ad7 100644 --- a/src/app/Magic/Fields/StandardFile.php +++ b/src/app/Magic/Fields/StandardFile.php @@ -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'; + } + } }