Skip to content

Commit 66c6e66

Browse files
committed
Update navigation item facade to support the attribute parameter
1 parent c087bbf commit 66c6e66

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/framework/src/Facades/Navigation.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ class Navigation
2121
* @param string<\Hyde\Support\Models\RouteKey>|string $destination Route key, or an external URI.
2222
* @param string|null $label If not provided, Hyde will try to get it from the route's connected page, or from the URL.
2323
* @param int|null $priority If not provided, Hyde will try to get it from the route or the default priority of 500.
24+
* @param array<string, scalar> $attributes Additional attributes for the navigation item.
2425
*/
25-
public static function item(string $destination, ?string $label = null, ?int $priority = null): array
26+
public static function item(string $destination, ?string $label = null, ?int $priority = null, array $attributes = []): array
2627
{
27-
return compact('destination', 'label', 'priority');
28+
return compact('destination', 'label', 'priority', 'attributes');
2829
}
2930
}

packages/framework/tests/Unit/Facades/NavigationFacadeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function testItem()
2020
'destination' => 'home',
2121
'label' => 'Home',
2222
'priority' => 100,
23+
'attributes' => [],
2324
], $item);
2425
}
2526

@@ -31,6 +32,7 @@ public function testItemWithOnlyDestination()
3132
'destination' => 'home',
3233
'label' => null,
3334
'priority' => null,
35+
'attributes' => [],
3436
], $item);
3537
}
3638

@@ -42,6 +44,7 @@ public function testItemWithUrl()
4244
'destination' => 'https://example.com',
4345
'label' => 'External',
4446
'priority' => 200,
47+
'attributes' => [],
4548
], $item);
4649
}
4750
}

0 commit comments

Comments
 (0)