]> _ Git - cubist_cms-back.git/commitdiff
wait #5300 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 30 May 2022 15:49:00 +0000 (17:49 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 30 May 2022 15:49:00 +0000 (17:49 +0200)
src/app/Magic/Fields/Hidden.php
src/resources/views/fields/hidden.blade.php

index 2e81e947e543980229c8d543249ba6caca766d65..7e24676174620070a1a93705c3aed01ae48ac35c 100644 (file)
@@ -4,8 +4,11 @@
 namespace Cubist\Backpack\Magic\Fields;
 
 
+use Cubist\Backpack\CubistBackpackServiceProvider;
+
 class Hidden extends Field
 {
     protected $_adminType = 'hidden';
+    protected $_viewNamespace = CubistBackpackServiceProvider::NAMESPACE . '::fields';
     protected $_preview = false;
 }
index f80c9d6c6a8e5924246c86628d8e8d90f90fea4f..71052fad9d6664f6af6e4259fb1739e058fd9d4b 100644 (file)
@@ -1,14 +1,18 @@
 @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')