@php use Illuminate\Support\Arr; if (!isset($field['wrapperAttributes']) || !isset($field['wrapperAttributes']['data-init-function'])){ $field['wrapperAttributes']['data-init-function'] = 'bpFieldInitUploadElement'; } if (!isset($field['wrapperAttributes']) || !isset($field['wrapperAttributes']['data-field-name'])) { $field['wrapperAttributes']['data-field-name'] = $field['name']; } $show_text = $field['show_text'] ?? false; if (isset($field['disk'])) { if (isset($field['temporary'])) { $file_url =Storage::disk($field['disk'])->temporaryUrl(Arr::get($field, 'prefix', '').$field['value'], Carbon\Carbon::now()->addMinutes($field['temporary'])); } else { $file_url = Storage::disk($field['disk'])->url(Arr::get($field, 'prefix', '').$field['value']); } } else if($field['file_url']) { $file_url = $field['file_url']; if (is_callable($field['file_url'])) { $file_url = $field['file_url']($entry ?? null); } } else { $file_url = Arr::get($field, 'prefix', '').$field['value']; } @endphp
@include('crud::inc.field_translatable_icon') {{-- Show the file name and a "Clear" button on EDIT form. --}} @if (!empty($field['value']))
@if($show_text) {{ $file_url }} @else @endif Delete
@endif {{-- Show the file picker on CREATE form. --}}
isset($field['value']) && $field['value']!=null?'file_input backstrap-file-input':'file_input backstrap-file-input']) >
{{-- HINT --}} @if (isset($field['hint']))

{!! $field['hint'] !!}

@endif
{{-- ########################################## --}} {{-- 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->fieldTypeNotLoaded($field)) @php $crud->markFieldTypeAsLoaded($field); if (! function_exists('maximumServerUploadSizeInBytes')) { function maximumServerUploadSizeInBytes() { $val = trim(ini_get('upload_max_filesize')); $last = strtolower($val[strlen($val)-1]); switch($last) { // The 'G' modifier is available since PHP 5.1.0 case 'g': $val = (int)$val * 1073741824; break; case 'm': $val = (int)$val * 1048576; break; case 'k': $val = (int)$val * 1024; break; } return $val; } } $max_image_size_in_bytes = $field['max_file_size'] ?? (int)maximumServerUploadSizeInBytes(); @endphp @push('crud_fields_styles') @endpush @push('crud_fields_scripts') @endpush @endif