]> _ Git - cubist_cms-back.git/commitdiff
#2810
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Jun 2019 10:47:44 +0000 (12:47 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Jun 2019 10:47:44 +0000 (12:47 +0200)
src/app/Magic/Fields/Field.php
src/app/Magic/Fields/Range.php [new file with mode: 0644]

index b91a007998d5e4c7e001e8f7d226fc6295229e37..a3b55ddcef37db90cc5830d04bcf2bcc37535b40 100644 (file)
@@ -68,7 +68,7 @@ class Field
             'fillable' => true, 'guarded' => false, 'hidden' => false, 'translatable' => $this->_translatable,
             'column_type' => $this->_columnType, 'default' => '', 'cast' => $this->_cast,
             'allow_null' => true,
-            'fake' => false, 'store_in' => false];
+            'fake' => false, 'store_in' => false, 'attributes' => []];
     }
 
     public function __construct($attributes)
@@ -153,5 +153,10 @@ class Field
         if ($this->getAttribute('fake', false) === true) {
             $this->setAttributeIfNotSet('store_in', 'extras');
         }
+        if ($this->hasAttribute('when')) {
+            $htmlAttributes = $this->getAttribute('attributes', []);
+            $htmlAttributes['data-when'] = json_encode($this->getAttribute('when'));
+            $this->setAttribute('attributes', $htmlAttributes);
+        }
     }
 }
diff --git a/src/app/Magic/Fields/Range.php b/src/app/Magic/Fields/Range.php
new file mode 100644 (file)
index 0000000..16d036c
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+
+
+namespace Cubist\Backpack\app\Magic\Fields;
+
+
+
+class Range extends Field
+{
+    protected $_adminType = 'range';
+}