--- /dev/null
+@php
+ $o=$field['value'] ?? old(square_brackets_to_dots($field['name']))??$field['default'];
+
+ $is_null=null===$o || $o==='null';
+ if(!function_exists('select2_from_array_selected')){
+ function select2_from_array_selected($key,$o){
+ if(null===$o || $o==='null'){
+ return false;
+ }
+ if(!is_array($o)){
+ return $o==$key;
+ }else {
+ return in_array($key,$o);
+ }
+ return false;
+ }
+ }
+@endphp
+
+ <!-- select2 from array -->
+@include('crud::fields.inc.wrapper_start')
+<label>{!! $field['label'] !!}</label>
+<ul class="checkbox-multiple">
+ @if (count($field['options']))
+ @foreach ($field['options'] as $key => $data)
+ @php
+ if(is_array($data)){
+ $value=$data['value'];
+ unset($data['value']);
+ }else{
+ $value=$data;
+ }
+ @endphp
+ <li><label><input type="checkbox" name="{{$field['name']}}[]" value="{{$key}}"
+ @if(!$is_null && select2_from_array_selected($key,$o)) checked @endif> {{$value}}</label>
+ </li>
+ @endforeach
+ @endif
+</ul>
+
+@if(isset($field['show_selected_option']) && $field['show_selected_option'])
+ <p class="help-block">{{__('Valeur actuelle : ')}} <span class="selectFromArrayCurrentValue"></span></p>
+@endif
+{{-- HINT --}}
+@if (isset($field['hint']))
+ <p class="help-block">{!! $field['hint'] !!}</p>
+@endif
+
+
+@include('crud::fields.inc.wrapper_end')
+
+{{-- ########################################## --}}
+{{-- Extra CSS and JS for this particular field --}}
+{{-- If a field type is shown multiple times on a form, the CSS and JS will only be loaded once --}}
+@if ($crud->checkIfFieldIsFirstOfItsType($field))
+ {{-- FIELD CSS - will be loaded in the after_styles section --}}
+ @push('crud_fields_styles')
+ <style>
+ ul.checkbox-multiple {
+ list-style-type: none;
+ padding-left: 0;
+ }
+ ul.checkbox-multiple input{
+ margin-right: 10px;
+ }
+ ul.checkbox-multiple label{
+ font-weight: 400;
+ }
+ </style>
+ @endpush
+ {{-- FIELD JS - will be loaded in the after_scripts section --}}
+ @push('crud_fields_scripts')
+ <script>
+
+ </script>
+ @endpush
+
+@endif
+{{-- End of Extra CSS and JS --}}
+{{-- ########################################## --}}