Skip to content

Commit

Permalink
Merge pull request #389 from hydephp/change-documentation-page-label-…
Browse files Browse the repository at this point in the history
…fallback-to-previous-behaviour

Change documentation page label fallback to previous behaviour hydephp/develop@a9270df
  • Loading branch information
github-actions committed Aug 8, 2022
1 parent bf78861 commit bcd4b69
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Concerns/FrontMatter/Schemas/DocumentationPageSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Hyde\Framework\Concerns\FrontMatter\Schemas;

use Hyde\Framework\Hyde;
use Illuminate\Support\Str;

trait DocumentationPageSchema
Expand Down Expand Up @@ -33,7 +34,7 @@ protected function constructDocumentationPageSchema(): void
{
$this->category = static::getDocumentationPageCategory();

$this->label = $this->matter('label', $this->title);
$this->label = $this->matter('label', Hyde::makeTitle(basename($this->identifier)));
$this->hidden = $this->matter('hidden', $this->identifier === 'index');
$this->priority = $this->matter('priority', $this->findPriorityInConfig());
}
Expand Down
4 changes: 3 additions & 1 deletion src/Models/DocumentationSidebar.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public function generate(): static
{
RoutingService::getInstance()->getRoutesForModel(DocumentationPage::class)->each(function (Route $route) {
if (! $route->getSourceModel()->get('hidden', false)) {
$this->items->push(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)));
$this->items->push(tap(NavItem::fromRoute($route)->setPriority($this->getPriorityForRoute($route)), function (NavItem $item) {
$item->title = $item->route->getSourceModel()->get('label');
}));
}
});

Expand Down

0 comments on commit bcd4b69

Please sign in to comment.