-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from hydephp/breaking-refactor-of-navigation-…
…groups Breaking refactor to further unify sidebar and navigation API
- Loading branch information
Showing
19 changed files
with
254 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
packages/framework/src/Contracts/FrontMatter/Support/NavigationSchema.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Hyde\Framework\Contracts\FrontMatter\Support; | ||
|
||
/** | ||
* @see \Hyde\Framework\Models\NavigationData | ||
* @see \Hyde\Framework\Concerns\HydePage | ||
*/ | ||
interface NavigationSchema | ||
{ | ||
public const NAVIGATION_SCHEMA = [ | ||
'label' => 'string', | ||
'group' => 'string', | ||
'hidden' => 'bool', | ||
'priority' => 'int', | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Hyde\Framework\Models; | ||
|
||
use Hyde\Framework\Concerns\JsonSerializesArrayable; | ||
use Hyde\Framework\Contracts\FrontMatter\Support\NavigationSchema; | ||
use Illuminate\Contracts\Support\Arrayable; | ||
|
||
final class NavigationData extends \ArrayObject implements NavigationSchema, Arrayable, \JsonSerializable | ||
{ | ||
use JsonSerializesArrayable; | ||
|
||
public ?string $label = null; | ||
public ?string $group = null; | ||
public ?bool $hidden = null; | ||
public ?int $priority = null; | ||
|
||
public function __construct(?string $label = null, ?string $group = null, ?bool $hidden = null, ?int $priority = null) | ||
{ | ||
$this->label = $label; | ||
$this->group = $group; | ||
$this->hidden = $hidden; | ||
$this->priority = $priority; | ||
|
||
parent::__construct($this->toArray()); | ||
} | ||
|
||
public static function make(array $data): self | ||
{ | ||
return new self( | ||
$data['label'] ?? null, | ||
$data['group'] ?? null, | ||
$data['hidden'] ?? null, | ||
$data['priority'] ?? null, | ||
); | ||
} | ||
|
||
public function toArray(): array | ||
{ | ||
return [ | ||
'label' => $this->label, | ||
'group' => $this->group, | ||
'hidden' => $this->hidden, | ||
'priority' => $this->priority, | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.