]> _ Git - cubist_cms-back.git/commitdiff
wip #4795 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 19 Oct 2021 13:41:04 +0000 (15:41 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 19 Oct 2021 13:41:04 +0000 (15:41 +0200)
src/app/Magic/Fields/Color.php
src/resources/views/columns/color.blade.php [new file with mode: 0644]

index d439333f333ed40478ab30c094844322b643557c..73f75adc1de20ffd4e637d6c6f9a258ecf2467b7 100644 (file)
@@ -12,7 +12,8 @@ class Color extends Field
     protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
     protected $_databaseType = 'string';
 
-    protected $_columnType = 'string';
+    protected $_columnType = 'color';
+    protected $_columnViewNamespace=CubistBackpackServiceProvider::NAMESPACE . '::columns';
     protected $_allowsAlpha = true;
     protected $_allowsEmpty = false;
 
diff --git a/src/resources/views/columns/color.blade.php b/src/resources/views/columns/color.blade.php
new file mode 100644 (file)
index 0000000..0cf3a4e
--- /dev/null
@@ -0,0 +1,12 @@
+{{-- regular object attribute --}}
+@php
+    $value = data_get($entry, $column['name']);
+
+@endphp
+
+<span>
+    @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_start')
+    <span
+        style="height: 25px;width:25px;background-color:{{$value}};display: inline-block;border-radius: 5px;margin-right: 5px;vertical-align: middle;position:relative;top:-2px;"></span> {{$value}}
+    @includeWhen(!empty($column['wrapper']), 'crud::columns.inc.wrapper_end')
+</span>