Skip to content

Commit

Permalink
Breaking: Remove DocumentationPage::hasTableOfContents method
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 8, 2024
1 parent b04bff2 commit b195b2f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 29 deletions.
2 changes: 2 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ This serves two purposes:
- Breaking: Removed the build task `\Hyde\Framework\Actions\PostBuildTasks\GenerateSearch` (see upgrade guide below)
- Breaking: Removed the deprecated `\Hyde\Framework\Services\BuildService::transferMediaAssets()` method (see upgrade guide below)
- Breaking: Removed the `DocumentationPage::getTableOfContents()` method as we now use Blade to generate the table of contents in https://github.com/hydephp/develop/pull/2045
- Breaking: Removed the `DocumentationPage::hasTableOfContents()` method as it is now unused by the framework in https://github.com/hydephp/develop/pull/2006
- Removed the deprecated global `unslash()` function, replaced with the namespaced `\Hyde\unslash()` function in https://github.com/hydephp/develop/pull/1754
- Removed the deprecated `BaseUrlNotSetException` class, with the `Hyde::url()` helper now throwing `BadMethodCallException` if no base URL is set in https://github.com/hydephp/develop/pull/1760
- Removed: The deprecated `PostAuthor::getName()` method is now removed (use `$author->name`) in https://github.com/hydephp/develop/pull/1782
Expand Down Expand Up @@ -573,6 +574,7 @@ The likelihood of impact is low, but if any of the following are true, you may n
- If you have used the `Hyde\Framework\Actions\GeneratesTableOfContents` class in custom code, you will likely need to update that code for the rewritten class.
- If you have published the `resources/views/components/docs/sidebar-item.blade.php` component, you will need to update it to call the new component instead of the old generator rendering.
- If you have called the now removed `getTableOfContents` method of the `DocumentationPage` class in custom code, you will need to update that usage as to possibly call the new Blade component directly, depending on your use case.
- If you have called the now removed `hasTableOfContents` method of the `DocumentationPage` class in custom code you will need to replace the method call with `Config::getBool('docs.sidebar.table_of_contents.enabled', true)`

#### Changes
- Adds a new `resources/views/components/docs/table-of-contents.blade.php` component containing the structure and styles for the table of contents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@ No description provided.
DocumentationPage::homeRouteName(): string
```

#### `hasTableOfContents()`

No description provided.

```php
DocumentationPage::hasTableOfContents(): bool
```

#### `getOnlineSourcePath()`

No description provided.
Expand Down
10 changes: 0 additions & 10 deletions packages/framework/src/Pages/DocumentationPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,6 @@ public function getOnlineSourcePath(): string|false
return sprintf('%s/%s.md', trim(Config::getString('docs.source_file_location_base'), '/'), $this->identifier);
}

/**
* @todo Remove unused method?
*
* @deprecated This is unused anc could be replaced by using the config directly.
*/
public static function hasTableOfContents(): bool
{
return Config::getBool('docs.sidebar.table_of_contents.enabled', true);
}

/**
* Get the route key for the page.
*
Expand Down
11 changes: 0 additions & 11 deletions packages/framework/tests/Feature/DocumentationPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,6 @@ public function testHomeRouteNameMethodReturnsCustomizedOutputDirectorySlashInde
$this->assertSame('foo/bar/index', DocumentationPage::homeRouteName());
}

public function testHasTableOfContents()
{
$this->assertIsBool(DocumentationPage::hasTableOfContents());

Config::set('docs.sidebar.table_of_contents.enabled', true);
$this->assertTrue(DocumentationPage::hasTableOfContents());

Config::set('docs.sidebar.table_of_contents.enabled', false);
$this->assertFalse(DocumentationPage::hasTableOfContents());
}

public function testCompiledPagesOriginatingInSubdirectoriesGetOutputToRootDocsPath()
{
$page = DocumentationPage::make('foo/bar');
Expand Down

0 comments on commit b195b2f

Please sign in to comment.