Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
703234b
Create Feature.php
emmadesilva Apr 8, 2024
6e0e79c
Mark enum as experimental
emmadesilva Apr 8, 2024
f69217a
Add enum description
emmadesilva Apr 8, 2024
7425d44
Add link to related class
emmadesilva Apr 8, 2024
0742896
Add enum cases based on features facade
emmadesilva Apr 8, 2024
89e5f7a
Back enum cases
emmadesilva Apr 8, 2024
4f086da
Import feature enum
emmadesilva Apr 8, 2024
07faf9c
Update feature methods to return feature instances
emmadesilva Apr 8, 2024
2b2cec7
Update state check method to take feature instead of string
emmadesilva Apr 8, 2024
295f7ae
Update array generics
emmadesilva Apr 8, 2024
0de3bea
Store internal state using the enum values
emmadesilva Apr 8, 2024
93c15c5
Fix illegal offset type
emmadesilva Apr 8, 2024
9a4a5de
Compare against enabled values
emmadesilva Apr 8, 2024
78cadab
Refactor unit test to use the enum
emmadesilva Apr 8, 2024
4696fdd
Update kernel helper to support features enum
emmadesilva Apr 8, 2024
66d69c7
Update reset logic to use added enum
emmadesilva Apr 8, 2024
05dc52b
Update method annotation
emmadesilva Apr 8, 2024
e6277b4
Update command to use features enum
emmadesilva Apr 8, 2024
c7efeee
Use enum cases as default array
emmadesilva Apr 8, 2024
98ffaf0
Remove the features getter
emmadesilva Apr 8, 2024
82e99e6
Inline local variables
emmadesilva Apr 8, 2024
2f5a472
Add todo
emmadesilva Apr 8, 2024
4c1db29
Merge multiple array assertions into assert same call
emmadesilva Apr 8, 2024
f43e047
Change internal parameter to null to get prettier IDE support
emmadesilva Apr 8, 2024
b1bfd84
Merge complex tests into single test with the same coverage
emmadesilva Apr 8, 2024
0fddc94
Add additional testing case
emmadesilva Apr 8, 2024
006bce8
Test serialized class state
emmadesilva Apr 8, 2024
7c50569
Return array representation using case mappings
emmadesilva Apr 8, 2024
db485e7
Rename closure parameter
emmadesilva Apr 8, 2024
e41e96d
Draft future closure logic
emmadesilva Apr 8, 2024
a032b33
Enable new logic
emmadesilva Apr 8, 2024
626ff0f
Simplify internal state complexity
emmadesilva Apr 8, 2024
ed86b9a
Update test names to be clearer
emmadesilva Apr 8, 2024
25f467c
Update test to use enum cases instead of reflection
emmadesilva Apr 8, 2024
2276ece
Inline helper method only used once
emmadesilva Apr 8, 2024
33c49b6
Test all enum cases have a features accessor
emmadesilva Apr 8, 2024
3568fe5
Format inline code in comment
emmadesilva Apr 8, 2024
db3d5f8
Breaking: Replace feature config helper methods with enum usages
emmadesilva Apr 8, 2024
049e894
Add method description
emmadesilva Apr 9, 2024
dfb56d5
Move up method in source
emmadesilva Apr 9, 2024
ed72df6
Remove legacy section comments for simplified class
emmadesilva Apr 9, 2024
89d735d
Replace local collect call with array helper
emmadesilva Apr 9, 2024
f7f9c37
Use array helper to match code style
emmadesilva Apr 9, 2024
a22ecba
Convert the arrow function to a traditional closure
emmadesilva Apr 9, 2024
15ca745
Replace continue with else branch
emmadesilva Apr 9, 2024
a1fecf2
Inline local variable
emmadesilva Apr 9, 2024
d27a416
Invert 'if' statement
emmadesilva Apr 9, 2024
64f438b
Revert "Invert 'if' statement"
emmadesilva Apr 9, 2024
17f0021
Simplify internal state to store the enums directly
emmadesilva Apr 9, 2024
36e8e2f
Inline simplified helper method
emmadesilva Apr 9, 2024
b11bc97
Inline simplified helper method
emmadesilva Apr 9, 2024
fd0eaf1
Use fully qualified class name in generics
emmadesilva Apr 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This serves two purposes:

### Changed
- **Breaking:** The internals of the navigation system has been rewritten into a new Navigation API. This change is breaking for custom navigation implementations. For more information, see below.
- **Breaking:** The `hyde.features` configuration format has changed to use Enums instead of static method calls. For more information, see below.
- Minor: Navigation menu items are now no longer filtered by duplicates (meaning two items with the same label can now exist in the same menu) in https://github.com/hydephp/develop/pull/1573
- Minor: Due to changes in the navigation system, it is possible that existing configuration files will need to be adjusted in order for menus to look the same (in terms of ordering etc.)
- Minor: The documentation article component now supports disabling the semantic rendering using a falsy value in https://github.com/hydephp/develop/pull/1566
Expand Down Expand Up @@ -70,6 +71,55 @@ The following configuration entries have been updated:
- Changed configuration option `docs.table_of_contents` to `docs.sidebar.table_of_contents` in https://github.com/hydephp/develop/pull/1584
- Upgrade path: Move the `table_of_contents` option's array in the `config/docs.php` file into the `sidebar` array in the same file.

### Features configuration changes

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.

#### Instead of

```php
// filepath: config/hyde.php

'features' => [
// Page Modules
Features::htmlPages(),
Features::markdownPosts(),
Features::bladePages(),
Features::markdownPages(),
Features::documentationPages(),

// Frontend Features
Features::darkmode(),
Features::documentationSearch(),

// Integrations
Features::torchlight(),
],
```

#### Use instead

```php
// filepath: config/hyde.php

'features' => [
// Page Modules
Feature::HtmlPages,
Feature::MarkdownPosts,
Feature::BladePages,
Feature::MarkdownPages,
Feature::DocumentationPages,

// Frontend Features
Feature::Darkmode,
Feature::DocumentationSearch,

// Integrations
Feature::Torchlight,
],
```

Of course, if you have disabled any of the features, do not include them in the new array.

## General impact

Expand Down
19 changes: 9 additions & 10 deletions config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*/

use Hyde\Facades\Author;
use Hyde\Facades\Features;
use Hyde\Facades\Meta;
use Hyde\Foundation\Concerns\Feature;

return [

Expand Down Expand Up @@ -248,24 +248,23 @@
|
| Some of Hyde's features are optional. Feel free to disable the features
| you don't need by removing or commenting them out from this array.
| This config concept is directly inspired by Laravel Jetstream.
|
*/

'features' => [
// Page Modules
Features::htmlPages(),
Features::markdownPosts(),
Features::bladePages(),
Features::markdownPages(),
Features::documentationPages(),
Feature::HtmlPages,
Feature::MarkdownPosts,
Feature::BladePages,
Feature::MarkdownPages,
Feature::DocumentationPages,

// Frontend Features
Features::darkmode(),
Features::documentationSearch(),
Feature::Darkmode,
Feature::DocumentationSearch,

// Integrations
Features::torchlight(),
Feature::Torchlight,
],

/*
Expand Down
4 changes: 2 additions & 2 deletions docs/creating-content/documentation-pages.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,12 @@ that runs during the build command, and a frontend JavaScript plugin that adds t

>info Tip: The HydeSearch plugin is what powers the search feature on this site! Why not [try it out](search)?

The search feature is enabled by default. You can disable it by removing the `documentationSearch` from the Hyde `Features` config array.
The search feature is enabled by default. You can disable it by removing the `DocumentationSearch` option from the Hyde `Features` config array.

```php
// filepath: config/hyde.php
'features' => [
Features::documentationSearch(), // [tl! --]
Feature::DocumentationSearch, // [tl! --]
],
```

Expand Down
19 changes: 9 additions & 10 deletions packages/framework/config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*/

use Hyde\Facades\Author;
use Hyde\Facades\Features;
use Hyde\Facades\Meta;
use Hyde\Foundation\Concerns\Feature;

return [

Expand Down Expand Up @@ -248,24 +248,23 @@
|
| Some of Hyde's features are optional. Feel free to disable the features
| you don't need by removing or commenting them out from this array.
| This config concept is directly inspired by Laravel Jetstream.
|
*/

'features' => [
// Page Modules
Features::htmlPages(),
Features::markdownPosts(),
Features::bladePages(),
Features::markdownPages(),
Features::documentationPages(),
Feature::HtmlPages,
Feature::MarkdownPosts,
Feature::BladePages,
Feature::MarkdownPages,
Feature::DocumentationPages,

// Frontend Features
Features::darkmode(),
Features::documentationSearch(),
Feature::Darkmode,
Feature::DocumentationSearch,

// Integrations
Features::torchlight(),
Feature::Torchlight,
],

/*
Expand Down
4 changes: 2 additions & 2 deletions packages/framework/src/Console/Commands/DebugCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ protected function printVerbosePathInformation(): void

protected function printEnabledFeatures(): void
{
/** @var array<string, string> $features */
/** @var array<\Hyde\Foundation\Concerns\Feature> $features */
$features = Config::getArray('hyde.features', []);

foreach ($features as $feature) {
$this->line(" - $feature");
$this->line(" - $feature->name");
}
}
}
Loading