Skip to content

Commit 6f26b22

Browse files
committed
Add asset container blueprint command palette links.
1 parent 13742cf commit 6f26b22

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/Assets/AssetContainer.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ public function showUrl()
183183
return cp_route('assets.browse.show', $this->handle());
184184
}
185185

186+
public function editBlueprintUrl()
187+
{
188+
return cp_route('blueprints.asset-containers.edit', $this->handle());
189+
}
190+
186191
public function apiUrl()
187192
{
188193
return null; // TODO
@@ -226,6 +231,14 @@ private function getBaseBlueprint()
226231
});
227232
}
228233

234+
public function blueprintCommandPaletteLink()
235+
{
236+
return $this->blueprint()?->commandPaletteLink(
237+
type: 'Asset Containers',
238+
url: $this->editBlueprintUrl(),
239+
);
240+
}
241+
229242
public function afterSave($callback)
230243
{
231244
$this->afterSaveCallbacks[] = $callback;

src/CommandPalette/Palette.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ protected function buildFields(): self
6868
->map(fn ($set) => $set->blueprintCommandPaletteLink())
6969
->each(fn (Link $link) => $this->addCommand($link));
7070

71+
Facades\AssetContainer::all()
72+
->map(fn ($container) => $container->blueprintCommandPaletteLink())
73+
->each(fn (Link $link) => $this->addCommand($link));
74+
7175
// TODO: Womp, got to end of this and realized they don't have `editUrl()` methods, so we'll refactor this to what's above ^
7276
// collect()
7377
// ->merge(Facades\Collection::all()->flatMap(fn ($collection) => $collection->entryBlueprints()))

0 commit comments

Comments
 (0)