@php
$max = $max ?? 1;
$required = $required ?? false;
$note = $note ?? '';
$fieldNote = $fieldNote ?? '';
$withAddInfo = $withAddInfo ?? true;
$withVideoUrl = $withVideoUrl ?? true;
$withCaption = $withCaption ?? true;
$altTextMaxLength = $altTextMaxLength ?? false;
$captionMaxLength = $captionMaxLength ?? false;
$extraMetadatas = $extraMetadatas ?? false;
$multiple = $max > 1 || $max == 0;
$widthMin = $widthMin ?? 0;
$heightMin = $heightMin ?? 0;
$buttonOnTop = $buttonOnTop ?? false;
$activeCrop = $activeCrop ?? true;
$disabled = $disabled ?? false;
@endphp
@if (config('twill.media_library.translated_form_fields', $translated ?? false) && ($translated ?? true))
{{ $note }}
@unless($renderForBlocks)
@push('vuexStore')
@foreach(getLocales() as $locale)
@if (isset($form_fields['medias']) && isset($form_fields['medias'][$locale][$name]))
window['{{ config('twill.js_namespace') }}'].STORE.medias.selected["{{ $name }}[{{ $locale }}]"] = {!! json_encode($form_fields['medias'][$locale][$name]) !!}
@endif
@endforeach
@endpush
@endunless
@else
@if($multiple) {{ $note }}@if($multiple) @else @endif
@unless($renderForBlocks)
@push('vuexStore')
@if (isset($form_fields['medias']) && isset($form_fields['medias'][$name]))
window['{{ config('twill.js_namespace') }}'].STORE.medias.selected["{{ $name }}"] = {!! json_encode($form_fields['medias'][$name]) !!}
@endif
@endpush
@endunless
@endif