Skip to content

Commit 4f3becc

Browse files
[6.x] Ensure nav customizations apply to breadcrumbs (#12460)
1 parent a985399 commit 4f3becc

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

src/CP/Breadcrumbs/Breadcrumbs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static function push(Breadcrumb $breadcrumb)
1717

1818
public static function build(): array
1919
{
20-
$breadcrumbs = Nav::build(preferences: false)->map(function (array $section): ?array {
20+
$breadcrumbs = Nav::build()->map(function (array $section): ?array {
2121
$primaryNavItem = $section['items']->first(function (NavItem $navItem) {
2222
return $navItem->isActive();
2323
});

tests/CP/Breadcrumbs/BreadcrumbsTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function it_builds_breadcrumbs_correctly_for_content_show_page()
102102
}
103103

104104
#[Test]
105-
public function it_ignores_nav_preferences_when_building_breadcrumbs()
105+
public function it_uses_nav_preferences_when_building_breadcrumbs()
106106
{
107107
$this->actingAs($user = User::make()->makeSuper())->get(cp_route('dashboard'));
108108

@@ -125,13 +125,18 @@ public function it_ignores_nav_preferences_when_building_breadcrumbs()
125125

126126
$breadcrumbs = Breadcrumbs::build();
127127

128-
// None of the preferences should be applied to the breadcrumbs.
129128
$this->assertEquals([
130129
new Breadcrumb(
131-
text: 'Dashboard',
130+
text: 'The Dashboard',
132131
url: 'http://localhost/cp/dashboard',
133-
icon: 'dashboard',
134-
links: []
132+
icon: 'browser-com',
133+
links: [
134+
['icon' => 'collections', 'text' => 'Collections', 'url' => 'http://localhost/cp/collections'],
135+
['icon' => 'navigation', 'text' => 'Navigation', 'url' => 'http://localhost/cp/navigation'],
136+
['icon' => 'taxonomies', 'text' => 'Taxonomies', 'url' => 'http://localhost/cp/taxonomies'],
137+
['icon' => 'assets', 'text' => 'Assets', 'url' => 'http://localhost/cp/assets'],
138+
['icon' => 'globals', 'text' => 'Globals', 'url' => 'http://localhost/cp/globals'],
139+
]
135140
),
136141
], $breadcrumbs);
137142
}

0 commit comments

Comments
 (0)