Action in Sub Navigation

Is it possible to add an Action component to a sub-navigation for a page. I have a cluster with the sub-navigation showing just fine. What I would like is to add the "Create" action (preferably styled as a button) below each item in the sub-navigation. I currently have the following code in my page component as a proof of concept:
public function getSubNavigation(): array
{
$cluster = static::getCluster();

$existingNav = $this->generateNavigationItems($cluster::getClusteredComponents());

foreach ($existingNav as $navItem) {

$navItem
->isActiveWhen(fn (): bool => true)
->childItems([
NavigationItem::make("Sub-Google")
->group(static::getNavigationGroup())
->parentItem(static::getNavigationParentItem())
->icon(static::getNavigationIcon())
->isActiveWhen(fn (): bool => false)
->url("https://www.google.ca"),
Actions\CreateAction::make(),
]);
}

return $existingNav;
}
public function getSubNavigation(): array
{
$cluster = static::getCluster();

$existingNav = $this->generateNavigationItems($cluster::getClusteredComponents());

foreach ($existingNav as $navItem) {

$navItem
->isActiveWhen(fn (): bool => true)
->childItems([
NavigationItem::make("Sub-Google")
->group(static::getNavigationGroup())
->parentItem(static::getNavigationParentItem())
->icon(static::getNavigationIcon())
->isActiveWhen(fn (): bool => false)
->url("https://www.google.ca"),
Actions\CreateAction::make(),
]);
}

return $existingNav;
}
The "NavigationItem" to google works just fine, but I get the following error when I try to add the action: Method Filament\Actions\CreateAction::isActive does not exist. I assume this is because the Action does not extend NavigationItem or Component. Is there some way I can accomplish this? I can, of course, add a NavigationItem to the create/edit URLs manually, but I'd rather be able to use something that would auto-generate the correct URLs.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server