Skip to content

Commit

Permalink
Added filtering based on Source language to Target options
Browse files Browse the repository at this point in the history
  • Loading branch information
afsakar committed Jan 28, 2024
1 parent c5ce042 commit 7d76280
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Actions/TranslatableAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ function (Field $component) {
Select::make('source')
->label(__('filament-translate-action::filament-translate-action.source'))
->options(fn () => getLangs())
->reactive()
->searchable()
->default((string) config('app.locale')),
Select::make('target')
->label(__('filament-translate-action::filament-translate-action.target'))
->options(fn () => getLangs())
->searchable()
->default((string) config('app.locale')),
->options(fn ($get) => collect(getLangs())
->filter(fn ($locale, $key) => $key != $get('source'))
->toArray())
->searchable(),
])
->modalSubmitActionLabel(__('filament-translate-action::filament-translate-action.translate'))
->action(function (array $data, $livewire) use ($component) {
Expand Down

0 comments on commit 7d76280

Please sign in to comment.