From 4206caef50e4a2b8d543ac6825405f2232f495a5 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 28 Oct 2022 17:11:53 +0200 Subject: [PATCH] wip #5468 --- .../views/fields/select2_from_array.blade.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/resources/views/fields/select2_from_array.blade.php b/src/resources/views/fields/select2_from_array.blade.php index a04b178..da87ff6 100644 --- a/src/resources/views/fields/select2_from_array.blade.php +++ b/src/resources/views/fields/select2_from_array.blade.php @@ -48,11 +48,24 @@ if($ajax){ @endif @if (count($field['options'])) - @foreach ($field['options'] as $key => $value) + @foreach ($field['options'] as $key => $data) + @php + $attrs=''; + if(is_array($data)){ + $value=$data['value']; + unset($data['value']); + foreach ($data as $k=>$v){ + $attrs.=' '.$k.'="'.$v.'"'; + } + }else{ + $value=$data; + } + + @endphp @if(!$is_null && select2_from_array_selected($key,$o)) - + @elseif(!$ajax) - + @endif @endforeach @endif -- 2.39.5