Skip to content

Commit 02b327c

Browse files
committed
Normalize helper method signatures
Using groupKey instead of identifier as the latter can also apply to the pages
1 parent 351ff64 commit 02b327c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/framework/src/Framework/Features/Navigation/BaseMenuGenerator.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,17 @@ protected function addRouteToGroup(Route $route): void
104104

105105
protected function getOrCreateGroupItem(string $groupName): NavItem
106106
{
107-
$identifier = Str::slug($groupName);
108-
$group = $this->items->get($identifier);
107+
$groupKey = Str::slug($groupName);
108+
$group = $this->items->get($groupKey);
109109

110-
return $group ?? $this->createGroupItem($identifier, $groupName);
110+
return $group ?? $this->createGroupItem($groupKey, $groupName);
111111
}
112112

113-
protected function createGroupItem(string $identifier, string $groupName): NavItem
113+
protected function createGroupItem(string $groupKey, string $groupName): NavItem
114114
{
115-
$label = $this->searchForGroupLabelInConfig($identifier) ?? $groupName;
115+
$label = $this->searchForGroupLabelInConfig($groupKey) ?? $groupName;
116116

117-
$priority = $this->searchForGroupPriorityInConfig($identifier);
117+
$priority = $this->searchForGroupPriorityInConfig($groupKey);
118118

119119
return NavItem::dropdown($this->normalizeGroupLabel($label), [], $priority);
120120
}
@@ -129,11 +129,11 @@ protected function normalizeGroupLabel(string $label): string
129129
return $label;
130130
}
131131

132-
protected function searchForGroupLabelInConfig(string $identifier): ?string
132+
protected function searchForGroupLabelInConfig(string $groupKey): ?string
133133
{
134134
$key = $this->generatesSidebar ? 'docs.sidebar_group_labels' : 'hyde.navigation.labels';
135135

136-
return Config::getArray($key, [])[$identifier] ?? null;
136+
return Config::getArray($key, [])[$groupKey] ?? null;
137137
}
138138

139139
protected function searchForGroupPriorityInConfig(string $groupKey): ?int

0 commit comments

Comments
 (0)