$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);
}
public function __construct($attributes)
{
$this->_attributes = $this->getDefaultAttributes();
+
foreach ($attributes as $attribute => $value) {
$this->setAttribute($attribute, $value);
}
--- /dev/null
+<?php
+
+
+namespace Cubist\Backpack\Magic\Fields;
+
+
+use Cubist\Backpack\CubistBackpackServiceProvider;
+
+class FormSection extends UnstoredField
+{
+ protected $_adminType = 'form_section';
+ protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+}
--- /dev/null
+</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')