Skip to content

Commit

Permalink
Merge pull request #1396 from hydephp/navigation-data-factory-cleanup
Browse files Browse the repository at this point in the history
Break down complex helper method hydephp/develop@528cd86
  • Loading branch information
github-actions committed Oct 27, 2023
1 parent 4893476 commit ffd197d
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/Framework/Factories/NavigationDataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ protected function makeHidden(): bool
{
return $this->isInstanceOf(MarkdownPost::class)
|| $this->searchForHiddenInFrontMatter()
|| in_array($this->routeKey, Config::getArray('hyde.navigation.exclude', ['404']))
|| (! $this->isInstanceOf(DocumentationPage::class) && $this->pageIsInSubdirectory() && ($this->getSubdirectoryConfiguration() === 'hidden'))
&& (basename($this->identifier) !== 'index');
|| $this->isPageHiddenInNavigationConfiguration()
|| $this->isNonDocumentationPageInHiddenSubdirectory();
}

protected function makePriority(): int
Expand Down Expand Up @@ -119,6 +118,19 @@ private function searchForHiddenInFrontMatter(): ?bool
?? $this->invert($this->getMatter('navigation.visible'));
}

private function isPageHiddenInNavigationConfiguration(): ?bool
{
return in_array($this->routeKey, Config::getArray('hyde.navigation.exclude', ['404']));
}

private function isNonDocumentationPageInHiddenSubdirectory(): bool
{
return ! $this->isInstanceOf(DocumentationPage::class)
&& $this->pageIsInSubdirectory()
&& $this->getSubdirectoryConfiguration() === 'hidden'
&& basename($this->identifier) !== 'index';
}

private function searchForPriorityInFrontMatter(): ?int
{
return $this->getMatter('navigation.priority')
Expand Down

0 comments on commit ffd197d

Please sign in to comment.