]> _ Git - cubist_cms-back.git/commitdiff
wip #3753 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 26 Nov 2020 07:55:35 +0000 (08:55 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 26 Nov 2020 07:55:35 +0000 (08:55 +0100)
src/app/Magic/Fields/Field.php
src/app/Magic/Fields/StaticValue.php [new file with mode: 0644]
src/resources/views/fields/static_value.blade.php [new file with mode: 0644]

index 30de6dc64d8ec3ccdb80df9457b0c50e47b95371..cc84ec07f28b4d89c177191bdf3d2384671114cf 100644 (file)
@@ -186,6 +186,9 @@ class Field implements \ArrayAccess
      */
     public function defineDbColumn($table)
     {
+        if ($this->getDatabaseType() === 'none') {
+            return;
+        }
         $name = $this->getAttribute('name');
         if ($name === 'created_at' || $name === 'updated_at') {
             return;
diff --git a/src/app/Magic/Fields/StaticValue.php b/src/app/Magic/Fields/StaticValue.php
new file mode 100644 (file)
index 0000000..3b1375f
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+
+namespace Cubist\Backpack\app\Magic\Fields;
+
+
+use Cubist\Backpack\CubistBackpackServiceProvider;
+
+class StaticValue extends Field
+{
+    protected $_adminType = 'static_value';
+    protected $_databaseType = 'none';
+    protected $_translatable = false;
+    protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+
+}
diff --git a/src/resources/views/fields/static_value.blade.php b/src/resources/views/fields/static_value.blade.php
new file mode 100644 (file)
index 0000000..6c02776
--- /dev/null
@@ -0,0 +1,12 @@
+<!-- text input -->
+@include('crud::fields.inc.wrapper_start')
+<label>{!! $field['label'] !!}</label>
+@include('crud::fields.inc.translatable_icon')
+
+@if(isset($field['prefix']) || isset($field['suffix'])) <div class="input-group"> @endif
+    {{ old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '' }}"
+{{-- HINT --}}
+@if (isset($field['hint']))
+<p class="help-block">{!! $field['hint'] !!}</p>
+@endif
+</div>