Skip to content

Commit 00f9d5f

Browse files
cklei-carlygithub-actions[bot]
authored andcommitted
Fix styling
1 parent c233863 commit 00f9d5f

File tree

6 files changed

+41
-37
lines changed

6 files changed

+41
-37
lines changed

src/Base/Dtos/Concerns/HasPropertyGroup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public function getPropertyGroup(string $key)
2525
}
2626

2727
$result = $this->propertyData->get($key, null);
28-
28+
2929
if ($result) {
30-
30+
3131
$locale = $this->getLocale() ?? $this->getFallbackLocale();
3232

3333
if ($result instanceof PropertyGroupCollection

src/Base/Filament/Concerns/ContentPreviewEditorTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public static function renderBuilderPreview(string $view, array $data): string
2727
'recordData',
2828
'propertyData',
2929
]);
30+
3031
return PreviewFactory::create()->renderContentPreview(
3132
documentType: $data['documentType'] ?? null,
3233
template: $data['template'] ?? null,
@@ -63,7 +64,7 @@ public function mutateInitialBuilderEditorData(string $builderName, array $edito
6364
}
6465

6566
$editorData['documentType'] = ($dt = $this->getDocumentType()) && $dt instanceof Model ? $dt->getKey() : ($dt ?? null); // primary key or model record
66-
$editorData['template'] = $this->data['template_id'] ?? null;
67+
$editorData['template'] = $this->data['template_id'] ?? null;
6768

6869
return $editorData;
6970
}

src/Base/Filament/Resources/Pages/BaseContentViewPage.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public static function renderPreviewModalView(string $view, array $data): string
124124
'template',
125125
'record',
126126
]);
127+
127128
return PreviewFactory::create()->renderContentPreview(
128129
documentType: $data['documentType'] ?? null,
129130
template: $data['template'] ?? null,

src/Content/DefaultPreviewProvider.php

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
use Pboivin\FilamentPeek\Support\Html;
99
use SolutionForest\InspireCms\Dtos\ContentDto;
1010
use SolutionForest\InspireCms\Dtos\PropertyTypeDto;
11-
use SolutionForest\InspireCms\Helpers\FieldTypeHelper;
1211
use SolutionForest\InspireCms\Helpers\PropertyTypeHelper;
1312
use SolutionForest\InspireCms\InspireCmsConfig;
1413
use SolutionForest\InspireCms\Models\Contracts\Content;
1514
use SolutionForest\InspireCms\Models\Contracts\DocumentType;
16-
use SolutionForest\InspireCms\Support\Helpers\KeyHelper;
1715

1816
class DefaultPreviewProvider implements PreviewProviderInterface
1917
{
@@ -32,12 +30,12 @@ public function renderContentPreview($documentType, $content, $template, $locale
3230
}
3331

3432
$locale ??= $data['activeLocale'] ?? $data['locale'] ?? null;
35-
33+
3634
if (isset($data['contentDTO']) && $data['contentDTO'] instanceof ContentDto) {
3735
$contentDTO = $data['contentDTO'];
3836
unset($data['contentDTO']);
3937

40-
} else if (is_array($content)) {
38+
} elseif (is_array($content)) {
4139
$contentDTO = static::getContentModelClass()::toPreviewDto(
4240
record: $content,
4341
propertyData: $propertyData,
@@ -51,6 +49,7 @@ public function renderContentPreview($documentType, $content, $template, $locale
5149
->danger()
5250
->seconds(60)
5351
->send();
52+
5453
return $this->renderBuilderPreview('Content not found');
5554
}
5655

@@ -65,19 +64,19 @@ public function renderContentPreview($documentType, $content, $template, $locale
6564

6665
return $this->renderBuilderPreview('Template not found');
6766
}
68-
67+
6968
if ($contentDTO instanceof ContentDto) {
7069
// Set the locale of the content dto to the active locale
7170
$contentDTO = $contentDTO->setLocale($locale);
7271
}
7372

7473
return $this->renderBuilderPreview(
7574
Blade::render(
76-
$templateContent,
75+
$templateContent,
7776
array_merge([
7877
'locale' => $locale,
7978
'content' => $contentDTO,
80-
], $data),
79+
], $data),
8180
true
8281
)
8382
);
@@ -117,7 +116,7 @@ public function renderTemplatePreview($templateContent, $documentType, $theme =
117116
if (view()->exists('components.' . $layoutName)) {
118117

119118
$newHtmlContent = Blade::render(
120-
"@extends('components.$layoutName')" . $templateContent,
119+
"@extends('components.$layoutName')" . $templateContent,
121120
array_merge($viewData, ['slot' => '', 'layoutName' => $layoutName]),
122121
);
123122

@@ -131,7 +130,7 @@ public function renderTemplatePreview($templateContent, $documentType, $theme =
131130
}
132131

133132
/**
134-
* @param int|Model|null $template
133+
* @param int|Model|null $template
135134
* @return ?string
136135
*/
137136
private function findTemplateContent($template)
@@ -142,11 +141,12 @@ private function findTemplateContent($template)
142141
if (! $template instanceof Model) {
143142
$template = InspireCmsConfig::getTemplateModelClass()::find($template);
144143
}
144+
145145
return $template?->getContent() ?? null;
146146
}
147-
147+
148148
/**
149-
* @param int|Model|null $documentType
149+
* @param int|Model|null $documentType
150150
* @return \Illuminate\Database\Eloquent\Model|null
151151
*/
152152
private function findDocumentType($documentType)
@@ -157,6 +157,7 @@ private function findDocumentType($documentType)
157157
if (! $documentType instanceof Model) {
158158
$documentType = InspireCmsConfig::getDocumentTypeModelClass()::find($documentType);
159159
}
160+
160161
return $documentType;
161162
}
162163

@@ -174,8 +175,8 @@ private function renderBuilderPreview(string $htmlContent)
174175
}
175176

176177
/**
177-
* @param DocumentType|Model|null $documentType
178-
* @param ?string $locale
178+
* @param DocumentType|Model|null $documentType
179+
* @param ?string $locale
179180
*/
180181
private function buildFakeContentDto($documentType, $locale)
181182
{

src/Content/PreviewProviderInterface.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010
interface PreviewProviderInterface
1111
{
1212
/**
13-
* @param int|Model|DocumentType|null $documentType
14-
* @param string|int|Model|Content|array|null $content
15-
* @param int|Model|Template|null $template
16-
* @param ?string $locale
17-
* @param array $propertyData
18-
* @param array $data
13+
* @param int|Model|DocumentType|null $documentType
14+
* @param string|int|Model|Content|array|null $content
15+
* @param int|Model|Template|null $template
16+
* @param ?string $locale
17+
* @param array $propertyData
18+
* @param array $data
1919
*/
2020
public function renderContentPreview($documentType, $content, $template, $locale = null, $propertyData = [], $data = []);
2121

2222
/**
23-
* @param string|null $template
24-
* @param int|Model|DocumentType|null $documentType
25-
* @param string|null $theme
26-
* @param ?string $locale
27-
* @param array $data
23+
* @param string|null $template
24+
* @param int|Model|DocumentType|null $documentType
25+
* @param string|null $theme
26+
* @param ?string $locale
27+
* @param array $data
2828
*/
2929
public function renderTemplatePreview($templateContent, $documentType, $theme = null, $locale = null, $data = []);
3030
}

src/Helpers/PropertyTypeHelper.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static function fakeDisplayValueForPropertyType($propertyType, $available
2525
{
2626
$fieldType = $propertyType->config;
2727
$value = null;
28-
28+
2929
if ($fieldType?->isTranslatable()) {
3030
$value = collect($availableLocales)
3131
->mapWithKeys(fn ($locale) => [$locale => static::fakeDisplayValueForFieldType($fieldType)])
@@ -45,15 +45,16 @@ public static function fakeDisplayValueForFieldType($fieldType)
4545
if ($fieldType instanceof \SolutionForest\InspireCms\Fields\Configs\Repeater) {
4646

4747
return collect(range(1, 3))
48-
->map(fn ($i) => collect($fieldType->fields)
49-
->mapWithKeys(function ($field) {
50-
$innerFieldType = FieldTypeHelper::getFieldTypeConfig($field['field'], $field['fieldConfig'] ?? []);
51-
52-
return [
53-
$field['name'] => static::fakeDisplayValueForFieldType($innerFieldType),
54-
];
55-
})
56-
->toArray()
48+
->map(
49+
fn ($i) => collect($fieldType->fields)
50+
->mapWithKeys(function ($field) {
51+
$innerFieldType = FieldTypeHelper::getFieldTypeConfig($field['field'], $field['fieldConfig'] ?? []);
52+
53+
return [
54+
$field['name'] => static::fakeDisplayValueForFieldType($innerFieldType),
55+
];
56+
})
57+
->toArray()
5758
)
5859
->all();
5960
}

0 commit comments

Comments
 (0)