-
-
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.
Support getting the search page from the kernel
In case it's been modified or injected somehow, this is a nicety to have
- Loading branch information
1 parent
158c6f2
commit 873b928
Showing
2 changed files
with
30 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,11 @@ | |
|
||
namespace Hyde\Console\Commands; | ||
|
||
use LaravelZero\Framework\Commands\Command; | ||
use Hyde\Pages\Concerns\HydePage; | ||
use Hyde\Foundation\Facades\Pages; | ||
use Hyde\Framework\Actions\StaticPageBuilder; | ||
use Hyde\Framework\Exceptions\FileNotFoundException; | ||
use LaravelZero\Framework\Commands\Command; | ||
use Hyde\Framework\Actions\GeneratesDocumentationSearchIndex; | ||
use Hyde\Framework\Features\Documentation\DocumentationSearchPage; | ||
|
||
|
@@ -22,12 +25,21 @@ class BuildSearchCommand extends Command | |
|
||
public function handle(): int | ||
{ | ||
StaticPageBuilder::handle(GeneratesDocumentationSearchIndex::makePage()); | ||
StaticPageBuilder::handle($this->getPageFromKernel() ?? GeneratesDocumentationSearchIndex::makePage()); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
caendesilva
Author
Member
|
||
|
||
if (DocumentationSearchPage::enabled()) { | ||
DocumentationSearchPage::generate(); | ||
} | ||
|
||
return Command::SUCCESS; | ||
} | ||
|
||
protected function getPageFromKernel(): ?HydePage | ||
{ | ||
try { | ||
return Pages::getPage('search.json'); | ||
} catch (FileNotFoundException) { | ||
return null; | ||
} | ||
} | ||
} |
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
OTOH not sure if this is how we would want to support the search index being changed