area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.71k stars 567 forks source link

fix: Non-translated media fields display as empty #2525

Open zeezo887 opened 5 months ago

zeezo887 commented 5 months ago

Description

This PR adds a new form field property disableTranslate() to force the field to disable translation when twill.media_library.translated_form_fields is set to true.

Usage:

FormBuilder

Medias::make()
    ->name('cover')
    ->label('Cover image')
    ->disableTranslate()
    ->max(5)

Directive

@formField('medias', [
    'name' => 'cover',
    'label' => 'Cover image',
    'note' => 'Also used in listings',
    'fieldNote' => 'Minimum image width: 1500px',
    'disableTranslate' => true
])

FormView

<x-twill::medias
    name="cover"
    label="Cover image"
    note="Also used in listings"
    field-note="Minimum image width: 1500px"
    disable-translate
/>

Related Issues

Fixes #483