You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added pboivin/filament-peek 0.3.0 to my filament 2.17.50 multi language app and added actions for any language in my system :
But How can I pass a locale parameter to my blade resources/views/filament/preview/page-content-edit-page-preview.blade.php file ?
Can I in someway to read in my blade file var from PreviewAction::make( method ?
I'm thinking of a way to simplify this but for now, you can use the ->before() method on the action and a property on the page class, here's a quick example:
class EditPage extends EditRecord
{
use HasPreviewModal;
protectedstaticstring$resource = PageResource::class;
publicstring$previewLanguage = '';
protectedfunctiongetActions(): array
{
return [
PreviewAction::make()
->before(fn ($livewire) => $livewire->previewLanguage = 'en')
->label('Preview Page (EN)'),
];
}
protectedfunctionmutatePreviewModalData(array$data): array
{
// This will make a `$language` variable available in your preview$data['language'] = $this->previewLanguage;
return$data;
}
// ...
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
From filamentphp/filament#7175
Hi @sergeynilov,
I'm thinking of a way to simplify this but for now, you can use the
->before()
method on the action and a property on the page class, here's a quick example:Beta Was this translation helpful? Give feedback.
All reactions