Skip to content

Commit b2f443c

Browse files
committed
Add breadcrumbs when when editing additional addon blueprint.
1 parent ac82fb5 commit b2f443c

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/Http/Controllers/CP/Fields/AdditionalBlueprintController.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
namespace Statamic\Http\Controllers\CP\Fields;
44

55
use Illuminate\Http\Request;
6+
use Statamic\CP\Breadcrumbs\Breadcrumb;
7+
use Statamic\CP\Breadcrumbs\Breadcrumbs;
68
use Statamic\Exceptions\NotFoundHttpException;
79
use Statamic\Facades\Blueprint;
810
use Statamic\Http\Controllers\CP\CpController;
@@ -24,6 +26,26 @@ public function edit($namespace, $handle)
2426
throw new NotFoundHttpException;
2527
}
2628

29+
Breadcrumbs::push(new Breadcrumb(
30+
text: $blueprint->renderableNamespace(),
31+
));
32+
33+
Breadcrumbs::push(new Breadcrumb(
34+
text: $blueprint->title(),
35+
icon: 'blueprints',
36+
url: $blueprint->editAdditionalBlueprintUrl(),
37+
links: Blueprint::in($blueprint->namespace())
38+
->reject(fn ($b) => $b->handle() === $blueprint->handle())
39+
->map(function ($b) {
40+
return [
41+
'text' => $b->title(),
42+
'icon' => 'blueprints',
43+
'url' => $b->editAdditionalBlueprintUrl(),
44+
];
45+
})
46+
->all(),
47+
));
48+
2749
return view('statamic::blueprints.edit', [
2850
'blueprint' => $blueprint,
2951
'blueprintVueObject' => $this->toVueObject($blueprint),

0 commit comments

Comments
 (0)