From e9898d0fb552dcf7275102ca479f79381a29eba7 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Tue, 27 Dec 2022 10:36:03 +0100 Subject: [PATCH] Revert "Extract method for the Blade stub" This reverts commit 9d1dbf4efb65c0210a218717e35f3b06cd7bad8a. --- .../Actions/CreatesNewPublicationType.php | 93 +++++++++---------- 1 file changed, 45 insertions(+), 48 deletions(-) diff --git a/packages/framework/src/Framework/Actions/CreatesNewPublicationType.php b/packages/framework/src/Framework/Actions/CreatesNewPublicationType.php index d4ff3c797ab..e4e80fef082 100644 --- a/packages/framework/src/Framework/Actions/CreatesNewPublicationType.php +++ b/packages/framework/src/Framework/Actions/CreatesNewPublicationType.php @@ -68,51 +68,62 @@ protected function listTemplateName(): string protected function createDetailTemplate(): void { - $contents = $this->stubContents(<<<'BLADE' -
- @php/** @var \Hyde\Pages\PublicationPage $publication*/@endphp -

{{ $publication->title }}

-

- {{ $publication->markdown }} -

-
- -
-
-
- -
-

Front Matter Data

-
- @foreach($publication->matter->data as $key => $value) + $contents = <<<'BLADE' + @extends('hyde::layouts.app') + @section('content') +
+
+ @php/** @var \Hyde\Pages\PublicationPage $publication*/@endphp +

{{ $publication->title }}

+

+ {{ $publication->markdown }} +

+
+ +
+
+
+ +
+

Front Matter Data

+
+ @foreach($publication->matter->data as $key => $value)
{{ $key }}
{{ is_array($value) ? '(array) '. implode(', ', $value) : $value }}
- @endforeach -
-
- BLADE); + @endforeach +
+
+ + + @endsection + BLADE; $this->savePublicationFile("{$this->detailTemplateName()}.blade.php", $contents); } protected function createListTemplate(): void { - $contents = $this->stubContents(<<<'BLADE' -
-

Publications for type {{ $page->type->name }}

+ $contents = <<<'BLADE' + @extends('hyde::layouts.app') + @section('content') +
+
+

Publications for type {{ $page->type->name }}

+
    + @php/** @var \Hyde\Pages\PublicationPage $publication*/@endphp + @foreach($publications as $publication) +
  1. + {{ $publication->title }} +
  2. + @endforeach +
+
+
-
    - @php/** @var \Hyde\Pages\PublicationPage $publication*/@endphp - @foreach($publications as $publication) -
  1. - {{ $publication->title }} -
  2. - @endforeach -
-
- BLADE); + @endsection + BLADE; $this->savePublicationFile("{$this->listTemplateName()}.blade.php", $contents); } @@ -121,18 +132,4 @@ protected function savePublicationFile(string $filename, string $contents): int { return file_put_contents(Hyde::path("$this->directoryName/$filename"), "$contents\n"); } - - protected function stubContents(string $slot): string - { - return << - $slot - - - @endsection - BLADE; - } }