namespace Cubist\Backpack\Magic\Fields;
+use Cubist\Backpack\CubistBackpackServiceProvider;
+
class Hidden extends Field
{
protected $_adminType = 'hidden';
+ protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
protected $_preview = false;
}
@php
// if not otherwise specified, the hidden input should take up no space in the form
$field['wrapper']['class'] = $field['wrapper']['class'] ?? $field['wrapperAttributes']['class'] ?? "hidden";
+ $v=old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '';
+ if(!is_string($v)){
+ $v=json_encode($v);
+ }
@endphp
-<!-- hidden input -->
+ <!-- hidden input -->
@include('crud::fields.inc.wrapper_start')
<input
type="hidden"
name="{{ $field['name'] }}"
- value="{{ old(square_brackets_to_dots($field['name'])) ?? $field['value'] ?? $field['default'] ?? '' }}"
+ value="{{ $v }}"
@include('crud::fields.inc.attributes')
>
@include('crud::fields.inc.wrapper_end')