F
Filament7mo ago
Pscl

Adding Custom Action to TopBar

Hey all,

//AppServiceProvider.php

FilamentView::registerRenderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
function () {
$action = Action::make('sendIdea')
->label('moep')
->form([
TextInput::make('subject')->required(),
// RichEditor::make('body')->required(),
])
->action(function (array $data) {
// Handle the action logic here
dd($data);
});

return view('components.send-idea-button', compact('action'));
}
);

//send-idea-button.blade.php
<div>
{{ $action }}
</div>

//AppServiceProvider.php

FilamentView::registerRenderHook(
PanelsRenderHook::GLOBAL_SEARCH_AFTER,
function () {
$action = Action::make('sendIdea')
->label('moep')
->form([
TextInput::make('subject')->required(),
// RichEditor::make('body')->required(),
])
->action(function (array $data) {
// Handle the action logic here
dd($data);
});

return view('components.send-idea-button', compact('action'));
}
);

//send-idea-button.blade.php
<div>
{{ $action }}
</div>
The button is displayed at topbar, but the magic of opening the form is not happening. Which piece of the puzzle am I missing? Thanks for support!
2 Replies
awcodes
awcodes7mo ago
I think you’ll need to use it in a livewire component that is rendered in the renderHook. See https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component for more info.
Pscl
PsclOP7mo ago
Thanks. Just found this and trying out now!
Want results from more Discord servers?
Add your server