}
}
} catch (\Exception $e) {
- $this->line($e->getMessage());
+ $this->line($e->getTraceAsString());
}
}
}
{
protected $_adminType = 'color';
protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+
+ protected $_allowsAlpha = true;
+
+ public function getDefaultAttributes()
+ {
+ return array_merge(parent::getDefaultAttributes(), ['allows_alpha' => $this->_allowsAlpha]);
+ }
}
if (!isset($attributes['type'])) {
throw new Exception('You must specify a field type');
}
- if (!isset($attributes['name'])) {
- throw new Exception('You must specify a field name');
- }
+
$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');
+ }
return new $class($attributes);
}
--- /dev/null
+<?php
+
+
+namespace Cubist\Backpack\Magic\Fields;
+
+
+use Cubist\Backpack\CubistBackpackServiceProvider;
+
+class FormSeparator extends UnstoredField
+{
+ protected $_adminType = 'form_separator';
+ protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
+}
--- /dev/null
+<?php
+
+
+namespace Cubist\Backpack\Magic\Fields;
+
+
+class UnstoredField extends Field
+{
+
+}
use Cubist\Backpack\Magic\Controllers\CubistMagicController;
use Cubist\Backpack\Magic\EntityData;
use Cubist\Backpack\Magic\Fields\Field;
+use Cubist\Backpack\Magic\Fields\UnstoredField;
use Cubist\Backpack\Magic\PageData;
use Cubist\Backpack\Magic\QueryBuilder;
use Cubist\Backpack\Magic\Requests\CubistMagicUpdateRequest;
$table->setPrimaryKey([$this->primaryKey], 'pk_' . $this->table);
foreach ($this->_fields as $field) {
+ if ($field instanceof UnstoredField) {
+ continue;
+ }
if ($field->getAttribute('fake', false) !== false) {
continue;
}
<!-- html5 color input -->
@include('crud::fields.inc.wrapper_start')
- <label>{!! $field['label'] !!}</label>
- @include('crud::fields.inc.translatable_icon')
- <input
- type="text"
- class="spectrum"
- name="{{ $field['name'] }}"
- value="{{ old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '' }}"
- @include('crud::fields.inc.attributes')
- >
+<label>{!! $field['label'] !!}</label>
+@include('crud::fields.inc.translatable_icon')
+<input
+ type="text"
+ class="spectrum"
+ data-show-alpha="{{$field['allows_alpha']?'true':'false'}}"
+ name="{{ $field['name'] }}"
+ value="{{ old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '' }}"
+ @include('crud::fields.inc.attributes')
+>
- {{-- HINT --}}
- @if (isset($field['hint']))
- <p class="help-block">{!! $field['hint'] !!}</p>
- @endif
+{{-- HINT --}}
+@if (isset($field['hint']))
+ <p class="help-block">{!! $field['hint'] !!}</p>
+@endif
@include('crud::fields.inc.wrapper_end')
{{-- ########################################## --}}
<script>
$("input.spectrum").spectrum({
preferredFormat: "hex6",
- showAlpha: true,
showInput: true,
showInitial: true,
allowEmty: true,