]> _ Git - cubist_cms-back.git/commitdiff
wip #4216 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 20 Jan 2021 20:28:00 +0000 (21:28 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 20 Jan 2021 20:28:00 +0000 (21:28 +0100)
src/app/Console/Commands/CubistMagicCommand.php
src/app/Magic/Fields/Field.php
src/app/Magic/Fields/FormSection.php [new file with mode: 0644]
src/resources/views/fields/form_section.blade.php [new file with mode: 0644]
src/resources/views/fields/form_separator.blade.php [new file with mode: 0644]

index a76d6963af6f382f95879feb58f30f19a6d4fc06..73b542582d7b4c36d6dce615f30d9db2f9568da0 100644 (file)
@@ -29,7 +29,7 @@ class CubistMagicCommand extends CubistCommand
                         }
                     }
                 } catch (\Exception $e) {
-                    $this->line($e->getTraceAsString());
+                    $this->line($e->getMessage()."\n".$e->getTraceAsString());
                 }
             }
         }
index 5c685682492050e65eeb384c37b5f198de173277..34e2af541a4065d4a362dfd24596bbbfe7988721 100644 (file)
@@ -73,8 +73,13 @@ class Field implements \ArrayAccess
 
         $class = static::_getClass($attributes['type']);
         unset($attributes['type']);
-        if (!is_subclass_of($class, UnstoredField::class) && !isset($attributes['name'])) {
-            throw new Exception('You must specify a field name');
+        if (!isset($attributes['name'])) {
+            if (!is_subclass_of($class, UnstoredField::class)) {
+                throw new Exception('You must specify a field name');
+            } else {
+                $attributes['name'] = 'gen_' . sha1(rand(1, 1000000000000));
+            }
+
         }
         return new $class($attributes);
     }
@@ -138,6 +143,7 @@ class Field implements \ArrayAccess
     public function __construct($attributes)
     {
         $this->_attributes = $this->getDefaultAttributes();
+
         foreach ($attributes as $attribute => $value) {
             $this->setAttribute($attribute, $value);
         }
diff --git a/src/app/Magic/Fields/FormSection.php b/src/app/Magic/Fields/FormSection.php
new file mode 100644 (file)
index 0000000..17ad8ed
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+
+namespace Cubist\Backpack\Magic\Fields;
+
+
+use Cubist\Backpack\CubistBackpackServiceProvider;
+
+class FormSection extends UnstoredField
+{
+    protected $_adminType = 'form_section';
+    protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+}
diff --git a/src/resources/views/fields/form_section.blade.php b/src/resources/views/fields/form_section.blade.php
new file mode 100644 (file)
index 0000000..763b13f
--- /dev/null
@@ -0,0 +1,7 @@
+</div>
+</div>
+<div class="card">
+<div class="card-body row">
+@include('crud::fields.inc.wrapper_start')
+<h3 id="{{$field['name']}}">{{$field['label']}}</h3>
+@include('crud::fields.inc.wrapper_end')
diff --git a/src/resources/views/fields/form_separator.blade.php b/src/resources/views/fields/form_separator.blade.php
new file mode 100644 (file)
index 0000000..c723c26
--- /dev/null
@@ -0,0 +1,3 @@
+@include('crud::fields.inc.wrapper_start')
+<hr>
+@include('crud::fields.inc.wrapper_end')