Skip to content

Commit 8120b7c

Browse files
authored
Merge pull request #2315 from hydephp/resolve-final-todos
[2.x] Rename config option docs.sidebar_group_labels to docs.sidebar.labels
2 parents 09e667e + 7fb5406 commit 8120b7c

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

RELEASE_NOTES.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ This serves two purposes:
7575
- **Breaking:** Renamed the `hyde.navigation.subdirectories` configuration option to `hyde.navigation.subdirectory_display` in [#1818](https://github.com/hydephp/develop/pull/1818)
7676
- **Breaking:** Replaced `--run-dev` and `--run-prod` build command flags with a single `--vite` flag that uses Vite to build assets in [#2013](https://github.com/hydephp/develop/pull/2013)
7777
- **Breaking:** Removed `--run-prettier` build command flag and Prettier dependency in [#2312](https://github.com/hydephp/develop/pull/2312)
78+
- **Breaking:** Renamed configuration option `docs.sidebar_group_labels` to `docs.sidebar.labels` in [#2315](https://github.com/hydephp/develop/pull/2315)
7879
- **Breaking:** The `Author::create()` method now returns an array instead of a `PostAuthor` instance in [#1798](https://github.com/hydephp/develop/pull/1798) For more information, see below.
7980
- **Breaking:** The `Author::get()` method now returns `null` if an author is not found, rather than creating a new instance in [#1798](https://github.com/hydephp/develop/pull/1798) For more information, see below.
8081
- **Breaking:** The `hyde.authors` config setting should now be keyed by the usernames in [#1782](https://github.com/hydephp/develop/pull/1782) For more information, see below.
@@ -208,6 +209,25 @@ The following configuration entries have been updated:
208209
- Changed configuration option `docs.table_of_contents` to `docs.sidebar.table_of_contents` in https://github.com/hydephp/develop/pull/1584
209210
- Upgrade path: Move the `table_of_contents` option's array in the `config/docs.php` file into the `sidebar` array in the same file.
210211

212+
- Changed configuration option `docs.sidebar_group_labels` to `docs.sidebar.labels` in https://github.com/hydephp/develop/pull/2315
213+
- Upgrade path: Move the `sidebar_group_labels` option into the nested `sidebar.labels` structure in `config/docs.php`
214+
215+
**Before:**
216+
```php
217+
'sidebar_group_labels' => [
218+
'getting-started' => 'Getting Started',
219+
],
220+
```
221+
222+
**After:**
223+
```php
224+
'sidebar' => [
225+
'labels' => [
226+
'getting-started' => 'Getting Started',
227+
],
228+
],
229+
```
230+
211231
### Features configuration changes
212232

213233
The `hyde.features` configuration format has changed to use Enums instead of static method calls. This change is breaking as it will require you to update your `config/hyde.php` file.

docs/creating-content/documentation-pages.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,10 @@ When using the automatic sidebar grouping feature the titles of the groups are g
250250
```php
251251
// Filepath: config/docs.php
252252
253-
'sidebar_group_labels' => [
254-
'questions-and-answers' => 'Questions & Answers',
253+
'sidebar' => [
254+
'labels' => [
255+
'questions-and-answers' => 'Questions & Answers',
256+
],
255257
],
256258
```
257259

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,7 @@ protected function normalizeGroupLabel(string $label): string
191191

192192
protected function searchForGroupLabelInConfig(string $groupKey): ?string
193193
{
194-
// TODO: Normalize this: sidebar_group_labels -> docs.sidebar.labels
195-
return $this->getConfigArray($this->generatesSidebar ? 'docs.sidebar_group_labels' : 'hyde.navigation.labels')[$groupKey] ?? null;
194+
return $this->getConfigArray($this->generatesSidebar ? 'docs.sidebar.labels' : 'hyde.navigation.labels')[$groupKey] ?? null;
196195
}
197196

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

packages/framework/tests/Feature/AutomaticNavigationConfigurationsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ public function testSidebarWithConfigLabels()
866866

867867
public function testSidebarGroupLabelsCanBeSetInConfig()
868868
{
869-
config(['docs.sidebar_group_labels' => ['foo' => 'Bar']]);
869+
config(['docs.sidebar.labels' => ['foo' => 'Bar']]);
870870

871871
$this->assertSidebarEquals([
872872
['label' => 'Bar', 'children' => ['Bar']],
@@ -1021,7 +1021,7 @@ public function testSidebarItemGroupingIsNormalized()
10211021

10221022
public function testSidebarLabelsCanBeSetInConfig()
10231023
{
1024-
config(['docs.sidebar_group_labels' => ['foo' => 'Hello world!']]);
1024+
config(['docs.sidebar.labels' => ['foo' => 'Hello world!']]);
10251025

10261026
$this->assertSidebarEquals(['Hello world!'], [
10271027
new DocumentationPage('foo', ['navigation.group' => 'foo']),

0 commit comments

Comments
 (0)