Skip to content

Commit 13742cf

Browse files
committed
Add global set blueprint command palette links.
1 parent b319a88 commit 13742cf

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
@@ -64,6 +64,10 @@ protected function buildFields(): self
6464
->map(fn ($nav) => $nav->blueprintCommandPaletteLink())
6565
->each(fn (Link $link) => $this->addCommand($link));
6666

67+
Facades\GlobalSet::all()
68+
->map(fn ($set) => $set->blueprintCommandPaletteLink())
69+
->each(fn (Link $link) => $this->addCommand($link));
70+
6771
// TODO: Womp, got to end of this and realized they don't have `editUrl()` methods, so we'll refactor this to what's above ^
6872
// collect()
6973
// ->merge(Facades\Collection::all()->flatMap(fn ($collection) => $collection->entryBlueprints()))

src/Globals/GlobalSet.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ public function blueprint()
5555
return Blueprint::find('globals.'.$this->handle());
5656
}
5757

58+
public function blueprintCommandPaletteLink()
59+
{
60+
return $this->inDefaultSite()->blueprint()?->commandPaletteLink(
61+
type: 'Globals',
62+
url: $this->editBlueprintUrl(),
63+
);
64+
}
65+
5866
public function path()
5967
{
6068
return vsprintf('%s/%s.%s', [
@@ -268,6 +276,11 @@ public function deleteUrl()
268276
return cp_route('globals.destroy', $this->handle());
269277
}
270278

279+
public function editBlueprintUrl()
280+
{
281+
return cp_route('blueprints.globals.edit', $this->handle());
282+
}
283+
271284
public static function __callStatic($method, $parameters)
272285
{
273286
return Facades\GlobalSet::{$method}(...$parameters);

0 commit comments

Comments
 (0)