#Get the block's key when using ->extraItemActions()

4 messages · Page 1 of 1 (latest)

fluid ruin
#

Is there anyway to access the block item's key when using custom actions in extraItemActions()?

I can access the items data with getItemState() but I would need to know, what type of block it is.

Thank you!

heady nexus
fluid ruin
#

The uuid I have, yes. But each block has a key. I need the key.

heady nexus
#

I guess you can try using $component->getChildComponents() ?

Builder::make('stuff')
    ->extraItemActions([
        \Filament\Forms\Components\Actions\Action::make('testAction')
            ->icon('heroicon-m-user')
            ->action(function ($state, array $arguments, $component): void {
                dd($component->getChildComponents()[0]->getName());
            })
    ])
    ->blocks([
        Block::make('test')
            ->schema([
                TextInput::make('content'),
            ])
    ])