Skip to content

Commit

Permalink
Update the build service to group together dynamic pages
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jul 24, 2024
1 parent 2a97871 commit c201d3a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/framework/src/Framework/Services/BuildService.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Hyde\Framework\Services;

use Hyde\Hyde;
use Hyde\Pages\InMemoryPage;
use Hyde\Foundation\Facades\Routes;
use Hyde\Foundation\Kernel\RouteCollection;
use Hyde\Framework\Actions\StaticPageBuilder;
Expand Down Expand Up @@ -62,13 +63,21 @@ protected function compilePagesForClass(string $pageClass): void

protected function getClassPluralName(string $pageClass): string
{
if ($pageClass === InMemoryPage::class) {
return 'Dynamic Pages';
}

return preg_replace('/([a-z])([A-Z])/', '$1 $2', class_basename($pageClass)).'s';
}

/** @return array<class-string<\Hyde\Pages\Concerns\HydePage>> */
protected function getPageTypes(): array
{
return Hyde::pages()->map(function (HydePage $page): string {
if ($page instanceof InMemoryPage) {
return InMemoryPage::class;
}

return $page::class;
})->unique()->values()->toArray();
}
Expand Down

0 comments on commit c201d3a

Please sign in to comment.