|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace Shopware\Storefront\Theme\StorefrontPluginConfiguration; |
|
4
|
|
|
|
|
5
|
|
|
use Shopware\Core\Framework\Log\Package; |
|
6
|
|
|
use Shopware\Core\Framework\Struct\Struct; |
|
7
|
|
|
|
|
8
|
|
|
#[Package('storefront')] |
|
9
|
|
|
class StorefrontPluginConfiguration extends Struct |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @var array<string, mixed>|null |
|
13
|
|
|
*/ |
|
14
|
|
|
protected ?array $themeJson = []; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @var array<string, mixed>|null |
|
18
|
|
|
*/ |
|
19
|
|
|
protected ?array $themeConfig = []; |
|
20
|
|
|
|
|
21
|
|
|
protected ?string $name = null; |
|
22
|
|
|
|
|
23
|
|
|
protected ?string $previewMedia = null; |
|
24
|
|
|
|
|
25
|
|
|
protected ?string $author = null; |
|
26
|
|
|
|
|
27
|
|
|
protected ?bool $isTheme = null; |
|
28
|
|
|
|
|
29
|
|
|
protected FileCollection $styleFiles; |
|
30
|
|
|
|
|
31
|
|
|
protected FileCollection $scriptFiles; |
|
32
|
|
|
|
|
33
|
|
|
protected ?string $storefrontEntryFilepath = null; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @decrecated tag:v6.0.0 will no longer be nullable |
|
37
|
|
|
*/ |
|
38
|
|
|
protected ?string $basePath = null; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @var array<int, string> |
|
42
|
|
|
*/ |
|
43
|
|
|
protected array $assetPaths = []; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var array<string> |
|
47
|
|
|
*/ |
|
48
|
|
|
protected array $viewInheritance = []; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @var array<string, string> |
|
52
|
|
|
*/ |
|
53
|
|
|
protected array $iconSets = []; |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @var array<string> |
|
57
|
|
|
*/ |
|
58
|
|
|
private array $configInheritance = []; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @internal |
|
62
|
|
|
*/ |
|
63
|
|
|
public function __construct(protected string $technicalName) |
|
64
|
|
|
{ |
|
65
|
|
|
$this->styleFiles = new FileCollection(); |
|
66
|
|
|
$this->scriptFiles = new FileCollection(); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getTechnicalName(): string |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->technicalName; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function getName(): ?string |
|
75
|
|
|
{ |
|
76
|
|
|
return $this->name; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
public function setName(string $name): void |
|
80
|
|
|
{ |
|
81
|
|
|
$this->name = $name; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
public function getAuthor(): ?string |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->author; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
public function setAuthor(?string $author): void |
|
90
|
|
|
{ |
|
91
|
|
|
$this->author = $author; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
public function getIsTheme(): ?bool |
|
95
|
|
|
{ |
|
96
|
|
|
return $this->isTheme; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
public function setIsTheme(bool $isTheme): void |
|
100
|
|
|
{ |
|
101
|
|
|
$this->isTheme = $isTheme; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
public function getStyleFiles(): FileCollection |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->styleFiles; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
public function setStyleFiles(FileCollection $styleFiles): void |
|
110
|
|
|
{ |
|
111
|
|
|
$this->styleFiles = $styleFiles; |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
public function getScriptFiles(): FileCollection |
|
115
|
|
|
{ |
|
116
|
|
|
return $this->scriptFiles; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
public function setScriptFiles(FileCollection $scriptFiles): void |
|
120
|
|
|
{ |
|
121
|
|
|
$this->scriptFiles = $scriptFiles; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
public function getStorefrontEntryFilepath(): ?string |
|
125
|
|
|
{ |
|
126
|
|
|
return $this->storefrontEntryFilepath; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
public function setStorefrontEntryFilepath(?string $storefrontEntryFilepath): void |
|
130
|
|
|
{ |
|
131
|
|
|
$this->storefrontEntryFilepath = $storefrontEntryFilepath; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function getBasePath(): string |
|
135
|
|
|
{ |
|
136
|
|
|
return $this->basePath ?? ''; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
public function setBasePath(string $basePath): void |
|
140
|
|
|
{ |
|
141
|
|
|
$this->basePath = $basePath; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @return array<int, string> |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getAssetPaths(): array |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->assetPaths; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @param array<int, string> $assetPaths |
|
154
|
|
|
*/ |
|
155
|
|
|
public function setAssetPaths(array $assetPaths): void |
|
156
|
|
|
{ |
|
157
|
|
|
$this->assetPaths = $assetPaths; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @return array<string, mixed>|null |
|
162
|
|
|
*/ |
|
163
|
|
|
public function getThemeConfig(): ?array |
|
164
|
|
|
{ |
|
165
|
|
|
return $this->themeConfig; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @param array<string, mixed>|null $themeConfig |
|
170
|
|
|
*/ |
|
171
|
|
|
public function setThemeConfig(?array $themeConfig): void |
|
172
|
|
|
{ |
|
173
|
|
|
$this->themeConfig = $themeConfig; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
public function getPreviewMedia(): ?string |
|
177
|
|
|
{ |
|
178
|
|
|
return $this->previewMedia; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
public function setPreviewMedia(string $previewMedia): void |
|
182
|
|
|
{ |
|
183
|
|
|
$this->previewMedia = $previewMedia; |
|
184
|
|
|
} |
|
185
|
|
|
|
|
186
|
|
|
/** |
|
187
|
|
|
* @return array<string> |
|
188
|
|
|
*/ |
|
189
|
|
|
public function getViewInheritance(): array |
|
190
|
|
|
{ |
|
191
|
|
|
return $this->viewInheritance; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* @param array<string> $viewInheritance |
|
196
|
|
|
*/ |
|
197
|
|
|
public function setViewInheritance(array $viewInheritance): void |
|
198
|
|
|
{ |
|
199
|
|
|
$this->viewInheritance = $viewInheritance; |
|
200
|
|
|
} |
|
201
|
|
|
|
|
202
|
|
|
/** |
|
203
|
|
|
* @return array<string, string> |
|
204
|
|
|
*/ |
|
205
|
|
|
public function getIconSets(): array |
|
206
|
|
|
{ |
|
207
|
|
|
return $this->iconSets; |
|
208
|
|
|
} |
|
209
|
|
|
|
|
210
|
|
|
/** |
|
211
|
|
|
* @param array<string, string> $iconSets |
|
212
|
|
|
*/ |
|
213
|
|
|
public function setIconSets(array $iconSets): void |
|
214
|
|
|
{ |
|
215
|
|
|
$this->iconSets = $iconSets; |
|
216
|
|
|
} |
|
217
|
|
|
|
|
218
|
|
|
public function hasFilesToCompile(): bool |
|
219
|
|
|
{ |
|
220
|
|
|
return \count($this->getStyleFiles()) !== 0 || \count($this->getScriptFiles()) !== 0; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* @param array<int, string> $configInheritance |
|
225
|
|
|
*/ |
|
226
|
|
|
public function setConfigInheritance(array $configInheritance): void |
|
227
|
|
|
{ |
|
228
|
|
|
$this->configInheritance = $configInheritance; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
/** |
|
232
|
|
|
* @return array<int, string> |
|
233
|
|
|
*/ |
|
234
|
|
|
public function getConfigInheritance(): array |
|
235
|
|
|
{ |
|
236
|
|
|
return $this->configInheritance; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
/** |
|
240
|
|
|
* @return array<string, mixed>|null |
|
241
|
|
|
*/ |
|
242
|
|
|
public function getThemeJson(): ?array |
|
243
|
|
|
{ |
|
244
|
|
|
return $this->themeJson; |
|
245
|
|
|
} |
|
246
|
|
|
|
|
247
|
|
|
/** |
|
248
|
|
|
* @param array<string, mixed>|null $themeJson |
|
249
|
|
|
*/ |
|
250
|
|
|
public function setThemeJson(?array $themeJson): void |
|
251
|
|
|
{ |
|
252
|
|
|
$this->themeJson = $themeJson; |
|
253
|
|
|
} |
|
254
|
|
|
} |
|
255
|
|
|
|