]> _ Git - cubist_cms-back.git/commitdiff
#2810
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 11 Jun 2019 12:48:21 +0000 (14:48 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 11 Jun 2019 12:48:21 +0000 (14:48 +0200)
src/app/Magic/Fields/Field.php
src/app/Magic/Fields/Files.php
src/app/Magic/Fields/Images.php

index 03232e3859b897d7ce6566e6f0a8cdc98e671dde..25eead739302126401dc24aad79d0ebd2ba077b0 100644 (file)
@@ -54,6 +54,7 @@ class Field
         return $this->_databaseType;
     }
 
+
     protected static function _getClass($type)
     {
         $type = Str::studly($type);
index e3006dcc28a2baf8341e8080328717869ca49d1c..85466a17abebaa6d42b2f9385b3dca2600fcde82 100644 (file)
@@ -7,10 +7,24 @@ namespace Cubist\Backpack\app\Magic\Fields;
 class Files extends Field
 {
     protected $_mimeTypes = null;
+    protected $_multiple = false;
+    protected $_adminType = 'upload';
+    protected $_databaseType = 'text';
 
     public function getDefaultAttributes()
     {
-        return array_merge(parent::getDefaultAttributes(), ['mime_types' => $this->_mimeTypes]);
+        return array_merge(parent::getDefaultAttributes(), ['mime_types' => $this->_mimeTypes, 'multiple' => $this->_multiple]);
+    }
+
+    protected function _postSetAttributes()
+    {
+        if ($this->_multiple) {
+            $this->setAttribute('type', 'upload_multiple');
+        } else {
+            $this->setAttribute('type', 'upload');
+        }
+
+        return parent::_postSetAttributes();
     }
 
 }
index 2ded192a6de530e610a3bf04c6cbbabbe9fbecd3..580386b69f619f5f6fefbf2fa8c617d2688d27db 100644 (file)
@@ -6,9 +6,5 @@ namespace Cubist\Backpack\app\Magic\Fields;
 
 class Images extends Files
 {
-    protected $_adminType = 'upload';
-    protected $_databaseType = 'text';
-
-    protected $_mimeTypes = ['image/png', 'image/jpeg', 'image/svg+xml','image/webp','image/gif'];
-
+    protected $_mimeTypes = ['image/png', 'image/jpeg', 'image/svg+xml', 'image/webp', 'image/gif'];
 }