Skip to content

Commit

Permalink
Update virtual page class to support compiling anonymous Blade files
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Jan 12, 2023
1 parent d36dd27 commit f28119a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/framework/src/Pages/VirtualPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

namespace Hyde\Pages;

use Hyde\Framework\Actions\AnonymousViewCompiler;
use Hyde\Markdown\Models\FrontMatter;
use Hyde\Pages\Concerns\HydePage;
use Hyde\Pages\Contracts\DynamicPage;
use Illuminate\Support\Facades\View;

use function str_ends_with;

/**
* A virtual page is a page that does not have a source file.
*
Expand Down Expand Up @@ -70,7 +73,10 @@ public function getBladeView(): string
public function compile(): string
{
if (! $this->contents && $this->view) {
// TODO This needs to support Blade files if we're gonna use it for pagination.
if (str_ends_with($this->view, '.blade.php')) {
return AnonymousViewCompiler::call($this->view, $this->matter->toArray());
}

return View::make($this->getBladeView(), $this->matter->toArray())->render();
}

Expand Down

0 comments on commit f28119a

Please sign in to comment.