Skip to content

Commit d90e3b8

Browse files
committed
Add form blueprint command palette links.
1 parent 6f26b22 commit d90e3b8

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/CommandPalette/Palette.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ protected function buildFields(): self
7272
->map(fn ($container) => $container->blueprintCommandPaletteLink())
7373
->each(fn (Link $link) => $this->addCommand($link));
7474

75+
Facades\Form::all()
76+
->map(fn ($form) => $form->blueprintCommandPaletteLink())
77+
->each(fn (Link $link) => $this->addCommand($link));
78+
7579
// TODO: Womp, got to end of this and realized they don't have `editUrl()` methods, so we'll refactor this to what's above ^
7680
// collect()
7781
// ->merge(Facades\Collection::all()->flatMap(fn ($collection) => $collection->entryBlueprints()))

src/Forms/Form.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ public function blueprint()
9191
return $blueprint;
9292
}
9393

94+
public function blueprintCommandPaletteLink()
95+
{
96+
return $this->blueprint()?->commandPaletteLink(
97+
type: 'Forms',
98+
url: $this->editBlueprintUrl(),
99+
);
100+
}
101+
94102
/**
95103
* Get or set the honeypot field.
96104
*
@@ -390,6 +398,11 @@ public function deleteUrl()
390398
return cp_route('forms.destroy', $this->handle());
391399
}
392400

401+
public function editBlueprintUrl()
402+
{
403+
return cp_route('blueprints.forms.edit', $this->handle());
404+
}
405+
393406
public function hasFiles()
394407
{
395408
return $this->fields()->filter(function ($field) {

0 commit comments

Comments
 (0)