Skip to content

Commit d31f937

Browse files
committed
Merge remote-tracking branch 'origin/feature/add_toolbar_actions' into feature/add_toolbar_actions
2 parents 4c14a53 + 53cdc38 commit d31f937

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

src/Commands/FileGenerators/Concerns/CanGenerateTreeMethods.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected function addGetTreeToolbarActionsMethodToClass(ClassType $class, bool
3131
return [
3232
\SolutionForest\FilamentTree\Actions\CreateAction::make(),
3333
];
34-
PHP : <<<PHP
34+
PHP : <<<'PHP'
3535
return [];
3636
PHP;
3737

src/Commands/FileGenerators/TreeWidgetClassGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ protected function addMethodsToClass(ClassType $class): void
6969
{
7070
$this->addGetFormSchemaMethodToClass($class);
7171
$this->addGetViewFormSchemaMethodToClass($class);
72-
$this->addGetTreeToolbarActionsMethodToClass($class,true);
72+
$this->addGetTreeToolbarActionsMethodToClass($class, true);
7373
}
7474

7575
public function generate(): string

src/Components/Tree.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function getToolbarActions(): array
9999
public function getToolbarAction($name)
100100
{
101101
foreach ($this->toolbarActions as $action) {
102-
102+
103103
if ($action instanceof FilamentActionsActionGroup || $action instanceof ActionGroup) {
104104
if ($groupedAction = collect($action->getFlatActions())->get($name)) {
105105
return $groupedAction;

src/Concern/HasActions.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Closure;
66
use Filament\Actions\Action as FilamentActionsAction;
7-
use Filament\Actions\ActionGroup as FilamentActionsActionGroup;
87
use Filament\Actions\Exceptions\ActionNotResolvableException;
98
use Filament\Schemas\Schema;
109
use Illuminate\Database\Eloquent\Model;
@@ -15,6 +14,7 @@
1514
trait HasActions
1615
{
1716
protected array $cachedTreeToolbarActions = [];
17+
1818
protected array $cachedTreeActions = [];
1919

2020
protected function resolveAction(array $action, array $parentActions): ?FilamentActionsAction
@@ -42,10 +42,10 @@ protected function resolveAction(array $action, array $parentActions): ?Filament
4242

4343
if (filled($action['context']['recordKey'] ?? null)) {
4444
$record = $this->getTreeRecord($action['context']['recordKey']);
45-
45+
4646
$resolvedAction->getRootGroup()?->record($record) ?? $resolvedAction->record($record);
4747
}
48-
48+
4949
return $resolvedAction;
5050
}
5151
}
@@ -71,14 +71,14 @@ public function cacheTreeActions(): void
7171
// Set tree on action
7272
if (method_exists($action, 'tree')) {
7373
$action = $action->tree($this->getCachedTree());
74-
}
74+
}
7575
// Set livewire on action
7676
else {
7777
$action = $action->livewire($this);
7878
}
7979

8080
return $action;
81-
};
81+
};
8282

8383
return collect($actions)
8484
->whereInstanceOf([
@@ -90,17 +90,17 @@ public function cacheTreeActions(): void
9090
if ($action instanceof ActionGroup) {
9191
return $action->getFlatActions();
9292
}
93+
9394
return [$action];
94-
})
95+
})
9596
// Configure action
96-
->map(fn (Action|FilamentActionsAction $action) =>
97-
$action->configureUsing(
98-
Closure::fromCallable([$this, 'configureTreeAction']),
99-
fn () => $action->configure(),
100-
)
97+
->map(fn (Action|FilamentActionsAction $action) => $action->configureUsing(
98+
Closure::fromCallable([$this, 'configureTreeAction']),
99+
fn () => $action->configure(),
100+
)
101101
)
102102
// Key by action name (resolve used)
103-
->mapWithKeys(fn (Action | FilamentActionsAction $action) => [
103+
->mapWithKeys(fn (Action|FilamentActionsAction $action) => [
104104
$action->getName() => $configureResolvedAction($action),
105105
])
106106
->all();

0 commit comments

Comments
 (0)