]> _ Git - cubist_cms-back.git/commitdiff
wip #4216
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 16 Jul 2021 17:42:53 +0000 (19:42 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 16 Jul 2021 17:42:53 +0000 (19:42 +0200)
src/app/Magic/Fields/Color.php
src/resources/views/fields/color.blade.php

index 941445e1822fe4e555482eb5bce48c683e5d5365..d439333f333ed40478ab30c094844322b643557c 100644 (file)
@@ -14,9 +14,10 @@ class Color extends Field
 
     protected $_columnType = 'string';
     protected $_allowsAlpha = true;
+    protected $_allowsEmpty = false;
 
     public function getDefaultAttributes()
     {
-        return array_merge(parent::getDefaultAttributes(), ['allows_alpha' => $this->_allowsAlpha]);
+        return array_merge(parent::getDefaultAttributes(), ['allows_alpha' => $this->_allowsAlpha, 'allows_empty' => $this->_allowsEmpty]);
     }
 }
index 23cc04914d6241a2c7ad49a2c98a75bbe059d32f..9437d0432c10598bc8c0c25d6b811c1fada3d5f0 100644 (file)
@@ -6,6 +6,7 @@
     type="text"
     class="spectrum"
     data-show-alpha="{{$field['allows_alpha']?'true':'false'}}"
+    data-allow-empty="{{$field['allows_empty']?'true':'false'}}"
     name="{{ $field['name'] }}"
     value="{{ old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '' }}"
     @include('crud::fields.inc.attributes')
@@ -36,7 +37,6 @@
                 preferredFormat: "hex6",
                 showInput: true,
                 showInitial: true,
-                allowEmty: true,
             });
         </script>
     @endpush