@@ -16,7 +16,7 @@ |
||
16 | 16 | */ |
17 | 17 | class Access extends Enumeration |
18 | 18 | { |
19 | - public const USER = 'user,group'; |
|
19 | + public const USER = 'user,group'; |
|
20 | 20 | |
21 | - public const ADMIN = 'admin'; |
|
21 | + public const ADMIN = 'admin'; |
|
22 | 22 | } |
@@ -16,9 +16,9 @@ |
||
16 | 16 | */ |
17 | 17 | class Parameter extends Enumeration |
18 | 18 | { |
19 | - public const PID = 'id'; |
|
19 | + public const PID = 'id'; |
|
20 | 20 | |
21 | - public const SUBMODULE = 'vidiModuleCode'; |
|
21 | + public const SUBMODULE = 'vidiModuleCode'; |
|
22 | 22 | |
23 | - public const MODULE = 'route'; |
|
23 | + public const MODULE = 'route'; |
|
24 | 24 | } |
@@ -16,13 +16,13 @@ |
||
16 | 16 | */ |
17 | 17 | class ModuleName extends Enumeration |
18 | 18 | { |
19 | - public const WEB = 'web'; |
|
19 | + public const WEB = 'web'; |
|
20 | 20 | |
21 | - public const FILE = 'file'; |
|
21 | + public const FILE = 'file'; |
|
22 | 22 | |
23 | - public const USER = 'user'; |
|
23 | + public const USER = 'user'; |
|
24 | 24 | |
25 | - public const ADMIN = 'admin'; |
|
25 | + public const ADMIN = 'admin'; |
|
26 | 26 | |
27 | - public const SYSTEM = 'system'; |
|
27 | + public const SYSTEM = 'system'; |
|
28 | 28 | } |
@@ -35,996 +35,996 @@ |
||
35 | 35 | */ |
36 | 36 | class ModuleLoader |
37 | 37 | { |
38 | - /** |
|
39 | - * Define the default main module |
|
40 | - */ |
|
41 | - public const DEFAULT_MAIN_MODULE = 'content'; |
|
42 | - |
|
43 | - /** |
|
44 | - * Define the default pid |
|
45 | - */ |
|
46 | - public const DEFAULT_PID = 0; |
|
47 | - |
|
48 | - /** |
|
49 | - * The type of data being listed (which corresponds to a table name in TCA) |
|
50 | - * |
|
51 | - * @var string |
|
52 | - */ |
|
53 | - protected $dataType; |
|
54 | - |
|
55 | - /** |
|
56 | - * @var string |
|
57 | - */ |
|
58 | - protected $defaultPid; |
|
59 | - |
|
60 | - /** |
|
61 | - * @var bool |
|
62 | - */ |
|
63 | - protected $isPidIgnored = false; |
|
64 | - |
|
65 | - /** |
|
66 | - * @var bool |
|
67 | - */ |
|
68 | - protected $showPageTree = false; |
|
69 | - |
|
70 | - /** |
|
71 | - * @var bool |
|
72 | - */ |
|
73 | - protected $isShown = true; |
|
74 | - |
|
75 | - /** |
|
76 | - * @var string |
|
77 | - */ |
|
78 | - protected $access; |
|
79 | - |
|
80 | - /** |
|
81 | - * @var string |
|
82 | - */ |
|
83 | - protected $mainModule; |
|
84 | - |
|
85 | - /** |
|
86 | - * @var string |
|
87 | - */ |
|
88 | - protected $position = ''; |
|
89 | - |
|
90 | - /** |
|
91 | - * @var string |
|
92 | - */ |
|
93 | - protected $icon; |
|
94 | - |
|
95 | - /** |
|
96 | - * @var string |
|
97 | - */ |
|
98 | - protected $moduleLanguageFile; |
|
99 | - |
|
100 | - /** |
|
101 | - * The module key such as m1, m2. |
|
102 | - * |
|
103 | - * @var string |
|
104 | - */ |
|
105 | - protected $moduleKey = 'm1'; |
|
106 | - |
|
107 | - /** |
|
108 | - * @var string[] |
|
109 | - */ |
|
110 | - protected $additionalJavaScriptFiles = []; |
|
111 | - |
|
112 | - /** |
|
113 | - * @var string[] |
|
114 | - */ |
|
115 | - protected $additionalStyleSheetFiles = []; |
|
116 | - |
|
117 | - /** |
|
118 | - * @var array |
|
119 | - */ |
|
120 | - protected $components = []; |
|
121 | - |
|
122 | - /** |
|
123 | - * @param string $dataType |
|
124 | - */ |
|
125 | - public function __construct($dataType = null) |
|
126 | - { |
|
127 | - $this->dataType = $dataType; |
|
128 | - |
|
129 | - // Initialize components |
|
130 | - $this->components = [ |
|
131 | - ModulePosition::DOC_HEADER => [ |
|
132 | - ModulePosition::TOP => [ |
|
133 | - ModulePosition::LEFT => [], |
|
134 | - ModulePosition::RIGHT => [ |
|
135 | - ToolButton::class, |
|
136 | - ], |
|
137 | - ], |
|
138 | - ModulePosition::BOTTOM => [ |
|
139 | - ModulePosition::LEFT => [ |
|
140 | - NewButton::class, |
|
141 | - BackViewHelper::class, |
|
142 | - ], |
|
143 | - ModulePosition::RIGHT => [], |
|
144 | - ], |
|
145 | - ], |
|
146 | - ModulePosition::GRID => [ |
|
147 | - ModulePosition::TOP => [ |
|
148 | - RelationsCheck::class, |
|
149 | - #\Fab\Vidi\View\Tab\DataTypeTab::class, |
|
150 | - ], |
|
151 | - ModulePosition::BUTTONS => [ |
|
152 | - EditButton::class, |
|
153 | - DeleteButton::class, |
|
154 | - ], |
|
155 | - ModulePosition::BOTTOM => [], |
|
156 | - ], |
|
157 | - ModulePosition::MENU_MASS_ACTION => [ |
|
158 | - ExportXlsMenuItem::class, |
|
159 | - ExportXmlMenuItem::class, |
|
160 | - ExportCsvMenuItem::class, |
|
161 | - DividerMenuItem::class, |
|
162 | - MassDeleteMenuItem::class, |
|
163 | - #\Fab\Vidi\View\MenuItem\MassEditMenuItem::class, |
|
164 | - ], |
|
165 | - ]; |
|
166 | - } |
|
167 | - |
|
168 | - /** |
|
169 | - * Tell whether a module is already registered. |
|
170 | - * |
|
171 | - * @param string $dataType |
|
172 | - * @return bool |
|
173 | - */ |
|
174 | - public function isRegistered($dataType): bool |
|
175 | - { |
|
176 | - $internalModuleSignature = $this->getInternalModuleSignature($dataType); |
|
177 | - return !empty($GLOBALS['TBE_MODULES_EXT']['vidi'][$internalModuleSignature]); |
|
178 | - } |
|
179 | - |
|
180 | - /** |
|
181 | - * @return array |
|
182 | - */ |
|
183 | - protected function getExistingInternalConfiguration(): array |
|
184 | - { |
|
185 | - $internalModuleSignature = $this->getInternalModuleSignature(); |
|
186 | - return $GLOBALS['TBE_MODULES_EXT']['vidi'][$internalModuleSignature] ?? []; |
|
187 | - } |
|
188 | - |
|
189 | - /** |
|
190 | - * @return array |
|
191 | - */ |
|
192 | - protected function getExistingMainConfiguration(): array |
|
193 | - { |
|
194 | - $moduleSignature = $this->computeMainModule() . '_' . $this->getInternalModuleSignature(); |
|
195 | - return $GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature] ?? []; |
|
196 | - } |
|
197 | - |
|
198 | - /** |
|
199 | - * @return string |
|
200 | - */ |
|
201 | - protected function computeMainModule(): string |
|
202 | - { |
|
203 | - $existingConfiguration = $this->getExistingInternalConfiguration(); |
|
204 | - |
|
205 | - if ($this->mainModule !== null) { |
|
206 | - $mainModule = $this->mainModule; |
|
207 | - } elseif (!empty($existingConfiguration['mainModule'])) { // existing configuration may override. |
|
208 | - $mainModule = $existingConfiguration['mainModule']; |
|
209 | - } else { |
|
210 | - $mainModule = self::DEFAULT_MAIN_MODULE; //default value. |
|
211 | - } |
|
212 | - return $mainModule; |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * @return string |
|
217 | - */ |
|
218 | - protected function computeDefaultPid(): string |
|
219 | - { |
|
220 | - $existingConfiguration = $this->getExistingInternalConfiguration(); |
|
221 | - |
|
222 | - if ($this->defaultPid !== null) { |
|
223 | - $defaultPid = $this->defaultPid; |
|
224 | - } elseif (!empty($existingConfiguration['defaultPid'])) { // existing configuration may override. |
|
225 | - $defaultPid = $existingConfiguration['defaultPid']; |
|
226 | - } else { |
|
227 | - $defaultPid = self::DEFAULT_PID; //default value. |
|
228 | - } |
|
229 | - return $defaultPid; |
|
230 | - } |
|
231 | - |
|
232 | - /** |
|
233 | - * @return array |
|
234 | - */ |
|
235 | - protected function computeAdditionalJavaScriptFiles(): array |
|
236 | - { |
|
237 | - $additionalJavaScriptFiles = $this->additionalJavaScriptFiles; |
|
238 | - |
|
239 | - // Possible merge of existing javascript files. |
|
240 | - $existingConfiguration = $this->getExistingInternalConfiguration(); |
|
241 | - if (!empty($existingConfiguration['additionalJavaScriptFiles'])) { |
|
242 | - $additionalJavaScriptFiles = array_merge($additionalJavaScriptFiles, $existingConfiguration['additionalJavaScriptFiles']); |
|
243 | - } |
|
244 | - |
|
245 | - return $additionalJavaScriptFiles; |
|
246 | - } |
|
247 | - |
|
248 | - /** |
|
249 | - * @return array |
|
250 | - */ |
|
251 | - protected function computeAdditionalStyleSheetFiles(): array |
|
252 | - { |
|
253 | - $additionalStyleSheetFiles = $this->additionalStyleSheetFiles; |
|
254 | - |
|
255 | - // Possible merge of existing style sheets. |
|
256 | - $existingConfiguration = $this->getExistingInternalConfiguration(); |
|
257 | - if (!empty($existingConfiguration['additionalStyleSheetFiles'])) { |
|
258 | - $additionalStyleSheetFiles = array_merge($additionalStyleSheetFiles, $existingConfiguration['additionalStyleSheetFiles']); |
|
259 | - } |
|
260 | - |
|
261 | - return $additionalStyleSheetFiles; |
|
262 | - } |
|
263 | - |
|
264 | - /** |
|
265 | - * @return array |
|
266 | - */ |
|
267 | - protected function computeComponents(): array |
|
268 | - { |
|
269 | - // We override the config in any case. See if we need more than that. |
|
270 | - return $this->components; |
|
271 | - } |
|
272 | - |
|
273 | - /** |
|
274 | - * Register the module in two places: core + vidi internal. |
|
275 | - * |
|
276 | - * @return $this |
|
277 | - */ |
|
278 | - public function register(): self |
|
279 | - { |
|
280 | - // Internal Vidi module registration. |
|
281 | - $configuration = []; |
|
282 | - $configuration['dataType'] = $this->dataType; |
|
283 | - $configuration['mainModule'] = $this->computeMainModule(); |
|
284 | - $configuration['defaultPid'] = $this->computeDefaultPid(); |
|
285 | - $configuration['additionalJavaScriptFiles'] = $this->computeAdditionalJavaScriptFiles(); |
|
286 | - $configuration['additionalStyleSheetFiles'] = $this->computeAdditionalStyleSheetFiles(); |
|
287 | - $configuration['components'] = $this->computeComponents(); |
|
288 | - $configuration['isPidIgnored'] = $this->isPidIgnored; |
|
289 | - |
|
290 | - $internalModuleSignature = $this->getInternalModuleSignature(); |
|
291 | - $GLOBALS['TBE_MODULES_EXT']['vidi'][$internalModuleSignature] = $configuration; |
|
292 | - |
|
293 | - // Core module registration. |
|
294 | - // Register and displays module in the BE only if told, default is "true". |
|
295 | - if ($this->isShown) { |
|
296 | - $moduleConfiguration = []; |
|
297 | - #$moduleConfiguration['routeTarget'] = \Fab\Vidi\Controller\ContentController::class . '::mainAction', // what to do here? |
|
298 | - $moduleConfiguration['access'] = $this->getAccess(); |
|
299 | - $moduleConfiguration['labels'] = $this->getModuleLanguageFile(); |
|
300 | - $icon = $this->getIcon(); |
|
301 | - if ($icon) { |
|
302 | - $moduleConfiguration['icon'] = $icon; |
|
303 | - } |
|
304 | - |
|
305 | - if ($this->showPageTree) { |
|
306 | - $moduleConfiguration['navigationComponentId'] = 'TYPO3/CMS/Backend/PageTree/PageTreeElement'; |
|
307 | - $moduleConfiguration['inheritNavigationComponentFromMainModule'] = true; |
|
308 | - } else { |
|
309 | - $moduleConfiguration['inheritNavigationComponentFromMainModule'] = true; |
|
310 | - } |
|
311 | - |
|
312 | - ExtensionUtility::registerModule( |
|
313 | - 'Vidi', |
|
314 | - $this->computeMainModule(), |
|
315 | - $this->dataType . '_' . $this->moduleKey, |
|
316 | - $this->position, |
|
317 | - [ |
|
318 | - ContentController::class => 'index, list, delete, update, edit, copy, move, localize, sort, copyClipboard, moveClipboard', |
|
319 | - ToolController::class => 'welcome, work', |
|
320 | - FacetController::class => 'autoSuggest, autoSuggests', |
|
321 | - SelectionController::class => 'edit, update, create, delete, list, show', |
|
322 | - UserPreferencesController::class => 'save', |
|
323 | - ClipboardController::class => 'save, flush, show', |
|
324 | - ], |
|
325 | - $moduleConfiguration |
|
326 | - ); |
|
327 | - } |
|
328 | - return $this; |
|
329 | - } |
|
330 | - |
|
331 | - /** |
|
332 | - * Return the module code for a BE module. |
|
333 | - * |
|
334 | - * @return string |
|
335 | - */ |
|
336 | - public function getSignature(): string |
|
337 | - { |
|
338 | - $signature = GeneralUtility::_GP(Parameter::MODULE); |
|
339 | - $trimmedSignature = trim($signature, '/'); |
|
340 | - return str_replace(['/', 'module_'], ['_', ''], $trimmedSignature); |
|
341 | - } |
|
342 | - |
|
343 | - /** |
|
344 | - * Returns the current pid. |
|
345 | - * |
|
346 | - * @return int |
|
347 | - */ |
|
348 | - public function getCurrentPid(): int |
|
349 | - { |
|
350 | - return GeneralUtility::_GET(Parameter::PID) > 0 ? (int)GeneralUtility::_GET(Parameter::PID) : 0; |
|
351 | - } |
|
352 | - |
|
353 | - /** |
|
354 | - * Return the module URL. |
|
355 | - * |
|
356 | - * @param array $additionalParameters |
|
357 | - * @return string |
|
358 | - */ |
|
359 | - public function getModuleUrl(array $additionalParameters = []): string |
|
360 | - { |
|
361 | - $moduleCode = $this->getSignature(); |
|
362 | - |
|
363 | - // And don't forget the pid! |
|
364 | - if (GeneralUtility::_GET(Parameter::PID)) { |
|
365 | - $additionalParameters[Parameter::PID] = GeneralUtility::_GET(Parameter::PID); |
|
366 | - } |
|
367 | - |
|
368 | - return BackendUtility::getModuleUrl($moduleCode, $additionalParameters); |
|
369 | - } |
|
370 | - |
|
371 | - /** |
|
372 | - * Return the parameter prefix for a BE module. |
|
373 | - * |
|
374 | - * @return string |
|
375 | - */ |
|
376 | - public function getParameterPrefix(): string |
|
377 | - { |
|
378 | - return 'tx_vidi_' . strtolower($this->getSignature()); |
|
379 | - } |
|
380 | - |
|
381 | - /** |
|
382 | - * Return a configuration key or the entire module configuration array if not key is given. |
|
383 | - * |
|
384 | - * @param string $key |
|
385 | - * @return mixed |
|
386 | - */ |
|
387 | - public function getModuleConfiguration($key = '') |
|
388 | - { |
|
389 | - $vidiModuleCode = $this->getSignature(); |
|
390 | - |
|
391 | - // Module code must exist |
|
392 | - if (empty($GLOBALS['TBE_MODULES_EXT']['vidi'][$vidiModuleCode])) { |
|
393 | - $message = sprintf('Invalid or not existing module code "%s"', $vidiModuleCode); |
|
394 | - throw new InvalidKeyInArrayException($message, 1375092053); |
|
395 | - } |
|
396 | - |
|
397 | - $result = $GLOBALS['TBE_MODULES_EXT']['vidi'][$vidiModuleCode]; |
|
398 | - |
|
399 | - if (!empty($key)) { |
|
400 | - if (isset($result[$key])) { |
|
401 | - $result = $result[$key]; |
|
402 | - } else { |
|
403 | - // key must exist |
|
404 | - $message = sprintf('Invalid key configuration "%s"', $key); |
|
405 | - throw new InvalidKeyInArrayException($message, 1375092054); |
|
406 | - } |
|
407 | - } |
|
408 | - return $result; |
|
409 | - } |
|
410 | - |
|
411 | - /** |
|
412 | - * @param string $icon |
|
413 | - * @return $this |
|
414 | - */ |
|
415 | - public function setIcon($icon): self |
|
416 | - { |
|
417 | - $this->icon = $icon; |
|
418 | - return $this; |
|
419 | - } |
|
420 | - |
|
421 | - /** |
|
422 | - * @return string |
|
423 | - */ |
|
424 | - protected function getIcon(): string |
|
425 | - { |
|
426 | - $moduleConfiguration = $this->getExistingMainConfiguration(); |
|
427 | - |
|
428 | - if ($this->icon) { |
|
429 | - $icon = $this->icon; |
|
430 | - } else { |
|
431 | - $icon = $moduleConfiguration['icon'] ?? ''; |
|
432 | - } |
|
433 | - |
|
434 | - return $icon; |
|
435 | - } |
|
436 | - |
|
437 | - /** |
|
438 | - * @param string $mainModule |
|
439 | - * @return $this |
|
440 | - */ |
|
441 | - public function setMainModule($mainModule): self |
|
442 | - { |
|
443 | - $this->mainModule = $mainModule; |
|
444 | - return $this; |
|
445 | - } |
|
446 | - |
|
447 | - /** |
|
448 | - * @return string |
|
449 | - */ |
|
450 | - public function getMainModule(): string |
|
451 | - { |
|
452 | - if ($this->mainModule === null) { |
|
453 | - $this->mainModule = $this->getModuleConfiguration('mainModule'); |
|
454 | - } |
|
455 | - return $this->mainModule; |
|
456 | - } |
|
457 | - |
|
458 | - /** |
|
459 | - * @param string $moduleLanguageFile |
|
460 | - * @return $this |
|
461 | - */ |
|
462 | - public function setModuleLanguageFile($moduleLanguageFile): self |
|
463 | - { |
|
464 | - $this->moduleLanguageFile = $moduleLanguageFile; |
|
465 | - return $this; |
|
466 | - } |
|
467 | - |
|
468 | - /** |
|
469 | - * @param string $component |
|
470 | - * @return $this |
|
471 | - */ |
|
472 | - public function removeComponentFromDocHeader(string $component): self |
|
473 | - { |
|
474 | - foreach ($this->components[ModulePosition::DOC_HEADER] as $verticalPosition => $docHeaders) { |
|
475 | - foreach ($docHeaders as $horizontalPosition => $docHeader) { |
|
476 | - $index = array_search($component, $docHeader, true); |
|
477 | - if ($index !== false) { |
|
478 | - // $verticalPosition: top or bottom |
|
479 | - // $horizontalPosition: left or right |
|
480 | - unset($this->components[ModulePosition::DOC_HEADER][$verticalPosition][$horizontalPosition][$index]); |
|
481 | - } |
|
482 | - } |
|
483 | - } |
|
484 | - return $this; |
|
485 | - } |
|
486 | - |
|
487 | - /** |
|
488 | - * @param bool $isPidIgnored |
|
489 | - * @return $this |
|
490 | - */ |
|
491 | - public function ignorePid(bool $isPidIgnored): self |
|
492 | - { |
|
493 | - $this->isPidIgnored = $isPidIgnored; |
|
494 | - return $this; |
|
495 | - } |
|
496 | - |
|
497 | - /** |
|
498 | - * @return bool |
|
499 | - */ |
|
500 | - public function isPidIgnored(): bool |
|
501 | - { |
|
502 | - return $this->getModuleConfiguration('isPidIgnored'); |
|
503 | - } |
|
504 | - |
|
505 | - /** |
|
506 | - * @param string $component |
|
507 | - * @return bool |
|
508 | - */ |
|
509 | - public function hasComponentInDocHeader(string $component): bool |
|
510 | - { |
|
511 | - foreach ($this->getModuleConfiguration('components')[ModulePosition::DOC_HEADER] as $verticalPosition => $docHeaders) { |
|
512 | - foreach ($docHeaders as $horizontalPosition => $docHeader) { |
|
513 | - $index = array_search($component, $docHeader, true); |
|
514 | - if ($index !== false) { |
|
515 | - return true; |
|
516 | - } |
|
517 | - } |
|
518 | - } |
|
519 | - return false; |
|
520 | - } |
|
521 | - |
|
522 | - /** |
|
523 | - * @return string |
|
524 | - */ |
|
525 | - protected function getModuleLanguageFile(): string |
|
526 | - { |
|
527 | - $moduleConfiguration = $this->getExistingMainConfiguration(); |
|
528 | - |
|
529 | - if ($this->moduleLanguageFile) { |
|
530 | - $moduleLanguageFile = $this->moduleLanguageFile; |
|
531 | - } elseif ($moduleConfiguration['labels']) { // existing configuration may override. |
|
532 | - $moduleLanguageFile = $moduleConfiguration['labels']; |
|
533 | - } else { |
|
534 | - $moduleLanguageFile = ''; //default value. |
|
535 | - } |
|
536 | - |
|
537 | - return $moduleLanguageFile; |
|
538 | - } |
|
539 | - |
|
540 | - /** |
|
541 | - * @param string $position |
|
542 | - * @return $this |
|
543 | - */ |
|
544 | - public function setPosition($position): self |
|
545 | - { |
|
546 | - $this->position = $position; |
|
547 | - return $this; |
|
548 | - } |
|
549 | - |
|
550 | - /** |
|
551 | - * @return string |
|
552 | - */ |
|
553 | - public function getPosition(): string |
|
554 | - { |
|
555 | - return $this->position; |
|
556 | - } |
|
557 | - |
|
558 | - /** |
|
559 | - * @param array $files |
|
560 | - * @return $this |
|
561 | - */ |
|
562 | - public function addJavaScriptFiles(array $files): self |
|
563 | - { |
|
564 | - foreach ($files as $file) { |
|
565 | - $this->additionalJavaScriptFiles[] = $file; |
|
566 | - } |
|
567 | - return $this; |
|
568 | - } |
|
569 | - |
|
570 | - /** |
|
571 | - * @param string $fileNameAndPath |
|
572 | - * @return $this |
|
573 | - */ |
|
574 | - public function addJavaScriptFile($fileNameAndPath): self |
|
575 | - { |
|
576 | - $this->additionalJavaScriptFiles[] = $fileNameAndPath; |
|
577 | - return $this; |
|
578 | - } |
|
579 | - |
|
580 | - /** |
|
581 | - * @param array $files |
|
582 | - * @return $this |
|
583 | - */ |
|
584 | - public function addStyleSheetFiles(array $files): self |
|
585 | - { |
|
586 | - foreach ($files as $file) { |
|
587 | - $this->additionalStyleSheetFiles[] = $file; |
|
588 | - } |
|
589 | - return $this; |
|
590 | - } |
|
591 | - |
|
592 | - /** |
|
593 | - * @param string $fileNameAndPath |
|
594 | - * @return $this |
|
595 | - */ |
|
596 | - public function addStyleSheetFile($fileNameAndPath): self |
|
597 | - { |
|
598 | - $this->additionalStyleSheetFiles[] = $fileNameAndPath; |
|
599 | - return $this; |
|
600 | - } |
|
601 | - |
|
602 | - /** |
|
603 | - * @return string |
|
604 | - */ |
|
605 | - public function getDataType(): string |
|
606 | - { |
|
607 | - if ($this->dataType === null) { |
|
608 | - $this->dataType = $this->getModuleConfiguration('dataType'); |
|
609 | - } |
|
610 | - return $this->dataType; |
|
611 | - } |
|
612 | - |
|
613 | - /** |
|
614 | - * @return array |
|
615 | - */ |
|
616 | - public function getDataTypes(): array |
|
617 | - { |
|
618 | - $dataTypes = []; |
|
619 | - foreach ($GLOBALS['TBE_MODULES_EXT']['vidi'] as $module) { |
|
620 | - $dataTypes[] = $module['dataType']; |
|
621 | - } |
|
622 | - return $dataTypes; |
|
623 | - } |
|
624 | - |
|
625 | - /** |
|
626 | - * @param string $dataType |
|
627 | - * @return $this |
|
628 | - */ |
|
629 | - public function setDataType($dataType): self |
|
630 | - { |
|
631 | - $this->dataType = $dataType; |
|
632 | - return $this; |
|
633 | - } |
|
634 | - |
|
635 | - /** |
|
636 | - * @return int |
|
637 | - */ |
|
638 | - public function getDefaultPid(): int |
|
639 | - { |
|
640 | - if (empty($this->defaultPid)) { |
|
641 | - $this->defaultPid = $this->getModuleConfiguration('defaultPid'); |
|
642 | - } |
|
643 | - return (int)$this->defaultPid; |
|
644 | - } |
|
645 | - |
|
646 | - /** |
|
647 | - * @param string $defaultPid |
|
648 | - * @return $this |
|
649 | - */ |
|
650 | - public function setDefaultPid($defaultPid): self |
|
651 | - { |
|
652 | - $this->defaultPid = $defaultPid; |
|
653 | - return $this; |
|
654 | - } |
|
655 | - |
|
656 | - /** |
|
657 | - * @param bool $isPageTreeShown |
|
658 | - * @return $this |
|
659 | - */ |
|
660 | - public function showPageTree($isPageTreeShown): self |
|
661 | - { |
|
662 | - $this->showPageTree = $isPageTreeShown; |
|
663 | - return $this; |
|
664 | - } |
|
665 | - |
|
666 | - /** |
|
667 | - * @param string $isShown |
|
668 | - * @return $this |
|
669 | - */ |
|
670 | - public function isShown($isShown): self |
|
671 | - { |
|
672 | - $this->isShown = $isShown; |
|
673 | - return $this; |
|
674 | - } |
|
675 | - |
|
676 | - /** |
|
677 | - * @return $array |
|
678 | - */ |
|
679 | - public function getDocHeaderTopLeftComponents() |
|
680 | - { |
|
681 | - $configuration = $this->getModuleConfiguration(); |
|
682 | - return $configuration['components'][ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::LEFT]; |
|
683 | - } |
|
684 | - |
|
685 | - /** |
|
686 | - * @param array $components |
|
687 | - * @return $this |
|
688 | - */ |
|
689 | - public function setDocHeaderTopLeftComponents(array $components): self |
|
690 | - { |
|
691 | - $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::LEFT] = $components; |
|
692 | - return $this; |
|
693 | - } |
|
694 | - |
|
695 | - /** |
|
696 | - * @param string|array $components |
|
697 | - * @return $this |
|
698 | - */ |
|
699 | - public function addDocHeaderTopLeftComponents($components): self |
|
700 | - { |
|
701 | - if (is_string($components)) { |
|
702 | - $components = [$components]; |
|
703 | - } |
|
704 | - $currentComponents = $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::LEFT]; |
|
705 | - $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::LEFT] = array_merge($currentComponents, $components); |
|
706 | - return $this; |
|
707 | - } |
|
708 | - |
|
709 | - /** |
|
710 | - * @return $array |
|
711 | - */ |
|
712 | - public function getDocHeaderTopRightComponents() |
|
713 | - { |
|
714 | - $configuration = $this->getModuleConfiguration(); |
|
715 | - return $configuration['components'][ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::RIGHT]; |
|
716 | - } |
|
717 | - |
|
718 | - /** |
|
719 | - * @param array $components |
|
720 | - * @return $this |
|
721 | - */ |
|
722 | - public function setDocHeaderTopRightComponents(array $components): self |
|
723 | - { |
|
724 | - $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::RIGHT] = $components; |
|
725 | - return $this; |
|
726 | - } |
|
727 | - |
|
728 | - /** |
|
729 | - * @param string|array $components |
|
730 | - * @return $this |
|
731 | - */ |
|
732 | - public function addDocHeaderTopRightComponents($components): self |
|
733 | - { |
|
734 | - if (is_string($components)) { |
|
735 | - $components = [$components]; |
|
736 | - } |
|
737 | - $currentComponents = $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::RIGHT]; |
|
738 | - $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::RIGHT] = array_merge($currentComponents, $components); |
|
739 | - return $this; |
|
740 | - } |
|
741 | - |
|
742 | - /** |
|
743 | - * @return $array |
|
744 | - */ |
|
745 | - public function getDocHeaderBottomLeftComponents() |
|
746 | - { |
|
747 | - $configuration = $this->getModuleConfiguration(); |
|
748 | - return $configuration['components'][ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::LEFT]; |
|
749 | - } |
|
750 | - |
|
751 | - /** |
|
752 | - * @param array $components |
|
753 | - * @return $this |
|
754 | - */ |
|
755 | - public function setDocHeaderBottomLeftComponents(array $components): self |
|
756 | - { |
|
757 | - $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::LEFT] = $components; |
|
758 | - return $this; |
|
759 | - } |
|
760 | - |
|
761 | - /** |
|
762 | - * @param string|array $components |
|
763 | - * @return $this |
|
764 | - */ |
|
765 | - public function addDocHeaderBottomLeftComponents($components): self |
|
766 | - { |
|
767 | - if (is_string($components)) { |
|
768 | - $components = [$components]; |
|
769 | - } |
|
770 | - $currentComponents = $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::LEFT]; |
|
771 | - $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::LEFT] = array_merge($currentComponents, $components); |
|
772 | - return $this; |
|
773 | - } |
|
774 | - |
|
775 | - /** |
|
776 | - * @return $array |
|
777 | - */ |
|
778 | - public function getDocHeaderBottomRightComponents() |
|
779 | - { |
|
780 | - $configuration = $this->getModuleConfiguration(); |
|
781 | - return $configuration['components'][ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::RIGHT]; |
|
782 | - } |
|
783 | - |
|
784 | - /** |
|
785 | - * @param array $components |
|
786 | - * @return $this |
|
787 | - */ |
|
788 | - public function setDocHeaderBottomRightComponents(array $components): self |
|
789 | - { |
|
790 | - $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::RIGHT] = $components; |
|
791 | - return $this; |
|
792 | - } |
|
793 | - |
|
794 | - /** |
|
795 | - * @param string|array $components |
|
796 | - * @return $this |
|
797 | - */ |
|
798 | - public function addDocHeaderBottomRightComponents($components): self |
|
799 | - { |
|
800 | - if (is_string($components)) { |
|
801 | - $components = [$components]; |
|
802 | - } |
|
803 | - $currentComponents = $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::RIGHT]; |
|
804 | - $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::RIGHT] = array_merge($currentComponents, $components); |
|
805 | - return $this; |
|
806 | - } |
|
807 | - |
|
808 | - /** |
|
809 | - * @return $array |
|
810 | - */ |
|
811 | - public function getGridTopComponents() |
|
812 | - { |
|
813 | - $configuration = $this->getModuleConfiguration(); |
|
814 | - return $configuration['components'][ModulePosition::GRID][ModulePosition::TOP]; |
|
815 | - } |
|
816 | - |
|
817 | - /** |
|
818 | - * @param array $components |
|
819 | - * @return $this |
|
820 | - */ |
|
821 | - public function setGridTopComponents(array $components): self |
|
822 | - { |
|
823 | - $this->components[ModulePosition::GRID][ModulePosition::TOP] = $components; |
|
824 | - return $this; |
|
825 | - } |
|
826 | - |
|
827 | - /** |
|
828 | - * @param string|array $components |
|
829 | - * @return $this |
|
830 | - */ |
|
831 | - public function addGridTopComponents($components): self |
|
832 | - { |
|
833 | - if (is_string($components)) { |
|
834 | - $components = [$components]; |
|
835 | - } |
|
836 | - $currentComponents = $this->components[ModulePosition::GRID][ModulePosition::TOP]; |
|
837 | - $this->components[ModulePosition::GRID][ModulePosition::TOP] = array_merge($currentComponents, $components); |
|
838 | - return $this; |
|
839 | - } |
|
840 | - |
|
841 | - /** |
|
842 | - * @return mixed $array |
|
843 | - */ |
|
844 | - public function getGridBottomComponents() |
|
845 | - { |
|
846 | - $configuration = $this->getModuleConfiguration(); |
|
847 | - return $configuration['components'][ModulePosition::GRID][ModulePosition::BOTTOM]; |
|
848 | - } |
|
849 | - |
|
850 | - /** |
|
851 | - * @param array $components |
|
852 | - * @return $this |
|
853 | - */ |
|
854 | - public function setGridBottomComponents(array $components): self |
|
855 | - { |
|
856 | - $this->components[ModulePosition::GRID][ModulePosition::BOTTOM] = $components; |
|
857 | - return $this; |
|
858 | - } |
|
859 | - |
|
860 | - /** |
|
861 | - * @param string|array $components |
|
862 | - * @return $this |
|
863 | - */ |
|
864 | - public function addGridBottomComponents($components): self |
|
865 | - { |
|
866 | - if (is_string($components)) { |
|
867 | - $components = [$components]; |
|
868 | - } |
|
869 | - $currentComponents = $this->components[ModulePosition::GRID][ModulePosition::BOTTOM]; |
|
870 | - $this->components[ModulePosition::GRID][ModulePosition::BOTTOM] = array_merge($currentComponents, $components); |
|
871 | - return $this; |
|
872 | - } |
|
873 | - |
|
874 | - /** |
|
875 | - * @return $array |
|
876 | - */ |
|
877 | - public function getGridButtonsComponents() |
|
878 | - { |
|
879 | - $configuration = $this->getModuleConfiguration(); |
|
880 | - return $configuration['components'][ModulePosition::GRID][ModulePosition::BUTTONS]; |
|
881 | - } |
|
882 | - |
|
883 | - /** |
|
884 | - * @param array $components |
|
885 | - * @return $this |
|
886 | - */ |
|
887 | - public function setGridButtonsComponents(array $components): self |
|
888 | - { |
|
889 | - $this->components[ModulePosition::GRID][ModulePosition::BUTTONS] = $components; |
|
890 | - return $this; |
|
891 | - } |
|
892 | - |
|
893 | - /** |
|
894 | - * @param string|array $components |
|
895 | - * @return $this |
|
896 | - */ |
|
897 | - public function addGridButtonsComponents($components): self |
|
898 | - { |
|
899 | - if (is_string($components)) { |
|
900 | - $components = [$components]; |
|
901 | - } |
|
902 | - $currentComponents = $this->components[ModulePosition::GRID][ModulePosition::BUTTONS]; |
|
903 | - $this->components[ModulePosition::GRID][ModulePosition::BUTTONS] = array_merge($components, $currentComponents); |
|
904 | - return $this; |
|
905 | - } |
|
906 | - |
|
907 | - /** |
|
908 | - * @return $array |
|
909 | - */ |
|
910 | - public function getMenuMassActionComponents() |
|
911 | - { |
|
912 | - $configuration = $this->getModuleConfiguration(); |
|
913 | - return $configuration['components'][ModulePosition::MENU_MASS_ACTION]; |
|
914 | - } |
|
915 | - |
|
916 | - /** |
|
917 | - * @param array $components |
|
918 | - * @return $this |
|
919 | - */ |
|
920 | - public function setMenuMassActionComponents(array $components): self |
|
921 | - { |
|
922 | - $this->components[ModulePosition::MENU_MASS_ACTION] = $components; |
|
923 | - return $this; |
|
924 | - } |
|
925 | - |
|
926 | - /** |
|
927 | - * @param string|array $components |
|
928 | - * @return $this |
|
929 | - */ |
|
930 | - public function addMenuMassActionComponents($components): self |
|
931 | - { |
|
932 | - if (is_string($components)) { |
|
933 | - $components = [$components]; |
|
934 | - } |
|
935 | - $currentComponents = $this->components[ModulePosition::MENU_MASS_ACTION]; |
|
936 | - $this->components[ModulePosition::MENU_MASS_ACTION] = array_merge($components, $currentComponents); |
|
937 | - return $this; |
|
938 | - } |
|
939 | - |
|
940 | - /** |
|
941 | - * @return string |
|
942 | - */ |
|
943 | - protected function getAccess(): string |
|
944 | - { |
|
945 | - $moduleConfiguration = $this->getExistingMainConfiguration(); |
|
946 | - |
|
947 | - if ($this->access !== null) { |
|
948 | - $access = $this->access; |
|
949 | - } elseif (!empty($moduleConfiguration['access'])) { // existing configuration may override. |
|
950 | - $access = $moduleConfiguration['access']; |
|
951 | - } else { |
|
952 | - $access = Access::USER; //default value. |
|
953 | - } |
|
954 | - return $access; |
|
955 | - } |
|
956 | - |
|
957 | - /** |
|
958 | - * @param string $access |
|
959 | - * @return $this |
|
960 | - */ |
|
961 | - public function setAccess($access): self |
|
962 | - { |
|
963 | - $this->access = $access; |
|
964 | - return $this; |
|
965 | - } |
|
966 | - |
|
967 | - /** |
|
968 | - * @return \string[] |
|
969 | - */ |
|
970 | - public function getAdditionalJavaScriptFiles(): array |
|
971 | - { |
|
972 | - if (empty($this->additionalJavaScriptFiles)) { |
|
973 | - $this->additionalJavaScriptFiles = $this->getModuleConfiguration('additionalJavaScriptFiles'); |
|
974 | - } |
|
975 | - return $this->additionalJavaScriptFiles; |
|
976 | - } |
|
977 | - |
|
978 | - /** |
|
979 | - * @return \string[] |
|
980 | - */ |
|
981 | - public function getAdditionalStyleSheetFiles(): array |
|
982 | - { |
|
983 | - if (empty($this->additionalStyleSheetFiles)) { |
|
984 | - $this->additionalStyleSheetFiles = $this->getModuleConfiguration('additionalStyleSheetFiles'); |
|
985 | - } |
|
986 | - return $this->additionalStyleSheetFiles; |
|
987 | - } |
|
988 | - |
|
989 | - /** |
|
990 | - * @return array |
|
991 | - */ |
|
992 | - public function getComponents(): array |
|
993 | - { |
|
994 | - return $this->components; |
|
995 | - } |
|
996 | - |
|
997 | - /** |
|
998 | - * @param string $pluginName |
|
999 | - * @return bool |
|
1000 | - */ |
|
1001 | - public function hasPlugin($pluginName = ''): bool |
|
1002 | - { |
|
1003 | - $parameterPrefix = $this->getParameterPrefix(); |
|
1004 | - $parameters = GeneralUtility::_GET($parameterPrefix); |
|
1005 | - |
|
1006 | - $hasPlugin = !empty($parameters['plugins']) && is_array($parameters['plugins']); |
|
1007 | - if ($hasPlugin && $pluginName) { |
|
1008 | - $hasPlugin = in_array($pluginName, $parameters['plugins']); |
|
1009 | - } |
|
1010 | - return $hasPlugin; |
|
1011 | - } |
|
1012 | - |
|
1013 | - /** |
|
1014 | - * Compute the internal module code |
|
1015 | - * |
|
1016 | - * @param null|string $dataType |
|
1017 | - * @return string |
|
1018 | - */ |
|
1019 | - protected function getInternalModuleSignature($dataType = null): string |
|
1020 | - { |
|
1021 | - // Else we forge the module signature |
|
1022 | - if ($dataType === null) { |
|
1023 | - $dataType = $this->dataType; |
|
1024 | - } |
|
1025 | - $subModuleName = $dataType . '_' . $this->moduleKey; |
|
1026 | - |
|
1027 | - $mainModule = $this->mainModule ?: self::DEFAULT_MAIN_MODULE; |
|
1028 | - return $mainModule . '_Vidi' . GeneralUtility::underscoredToUpperCamelCase($subModuleName); |
|
1029 | - } |
|
38 | + /** |
|
39 | + * Define the default main module |
|
40 | + */ |
|
41 | + public const DEFAULT_MAIN_MODULE = 'content'; |
|
42 | + |
|
43 | + /** |
|
44 | + * Define the default pid |
|
45 | + */ |
|
46 | + public const DEFAULT_PID = 0; |
|
47 | + |
|
48 | + /** |
|
49 | + * The type of data being listed (which corresponds to a table name in TCA) |
|
50 | + * |
|
51 | + * @var string |
|
52 | + */ |
|
53 | + protected $dataType; |
|
54 | + |
|
55 | + /** |
|
56 | + * @var string |
|
57 | + */ |
|
58 | + protected $defaultPid; |
|
59 | + |
|
60 | + /** |
|
61 | + * @var bool |
|
62 | + */ |
|
63 | + protected $isPidIgnored = false; |
|
64 | + |
|
65 | + /** |
|
66 | + * @var bool |
|
67 | + */ |
|
68 | + protected $showPageTree = false; |
|
69 | + |
|
70 | + /** |
|
71 | + * @var bool |
|
72 | + */ |
|
73 | + protected $isShown = true; |
|
74 | + |
|
75 | + /** |
|
76 | + * @var string |
|
77 | + */ |
|
78 | + protected $access; |
|
79 | + |
|
80 | + /** |
|
81 | + * @var string |
|
82 | + */ |
|
83 | + protected $mainModule; |
|
84 | + |
|
85 | + /** |
|
86 | + * @var string |
|
87 | + */ |
|
88 | + protected $position = ''; |
|
89 | + |
|
90 | + /** |
|
91 | + * @var string |
|
92 | + */ |
|
93 | + protected $icon; |
|
94 | + |
|
95 | + /** |
|
96 | + * @var string |
|
97 | + */ |
|
98 | + protected $moduleLanguageFile; |
|
99 | + |
|
100 | + /** |
|
101 | + * The module key such as m1, m2. |
|
102 | + * |
|
103 | + * @var string |
|
104 | + */ |
|
105 | + protected $moduleKey = 'm1'; |
|
106 | + |
|
107 | + /** |
|
108 | + * @var string[] |
|
109 | + */ |
|
110 | + protected $additionalJavaScriptFiles = []; |
|
111 | + |
|
112 | + /** |
|
113 | + * @var string[] |
|
114 | + */ |
|
115 | + protected $additionalStyleSheetFiles = []; |
|
116 | + |
|
117 | + /** |
|
118 | + * @var array |
|
119 | + */ |
|
120 | + protected $components = []; |
|
121 | + |
|
122 | + /** |
|
123 | + * @param string $dataType |
|
124 | + */ |
|
125 | + public function __construct($dataType = null) |
|
126 | + { |
|
127 | + $this->dataType = $dataType; |
|
128 | + |
|
129 | + // Initialize components |
|
130 | + $this->components = [ |
|
131 | + ModulePosition::DOC_HEADER => [ |
|
132 | + ModulePosition::TOP => [ |
|
133 | + ModulePosition::LEFT => [], |
|
134 | + ModulePosition::RIGHT => [ |
|
135 | + ToolButton::class, |
|
136 | + ], |
|
137 | + ], |
|
138 | + ModulePosition::BOTTOM => [ |
|
139 | + ModulePosition::LEFT => [ |
|
140 | + NewButton::class, |
|
141 | + BackViewHelper::class, |
|
142 | + ], |
|
143 | + ModulePosition::RIGHT => [], |
|
144 | + ], |
|
145 | + ], |
|
146 | + ModulePosition::GRID => [ |
|
147 | + ModulePosition::TOP => [ |
|
148 | + RelationsCheck::class, |
|
149 | + #\Fab\Vidi\View\Tab\DataTypeTab::class, |
|
150 | + ], |
|
151 | + ModulePosition::BUTTONS => [ |
|
152 | + EditButton::class, |
|
153 | + DeleteButton::class, |
|
154 | + ], |
|
155 | + ModulePosition::BOTTOM => [], |
|
156 | + ], |
|
157 | + ModulePosition::MENU_MASS_ACTION => [ |
|
158 | + ExportXlsMenuItem::class, |
|
159 | + ExportXmlMenuItem::class, |
|
160 | + ExportCsvMenuItem::class, |
|
161 | + DividerMenuItem::class, |
|
162 | + MassDeleteMenuItem::class, |
|
163 | + #\Fab\Vidi\View\MenuItem\MassEditMenuItem::class, |
|
164 | + ], |
|
165 | + ]; |
|
166 | + } |
|
167 | + |
|
168 | + /** |
|
169 | + * Tell whether a module is already registered. |
|
170 | + * |
|
171 | + * @param string $dataType |
|
172 | + * @return bool |
|
173 | + */ |
|
174 | + public function isRegistered($dataType): bool |
|
175 | + { |
|
176 | + $internalModuleSignature = $this->getInternalModuleSignature($dataType); |
|
177 | + return !empty($GLOBALS['TBE_MODULES_EXT']['vidi'][$internalModuleSignature]); |
|
178 | + } |
|
179 | + |
|
180 | + /** |
|
181 | + * @return array |
|
182 | + */ |
|
183 | + protected function getExistingInternalConfiguration(): array |
|
184 | + { |
|
185 | + $internalModuleSignature = $this->getInternalModuleSignature(); |
|
186 | + return $GLOBALS['TBE_MODULES_EXT']['vidi'][$internalModuleSignature] ?? []; |
|
187 | + } |
|
188 | + |
|
189 | + /** |
|
190 | + * @return array |
|
191 | + */ |
|
192 | + protected function getExistingMainConfiguration(): array |
|
193 | + { |
|
194 | + $moduleSignature = $this->computeMainModule() . '_' . $this->getInternalModuleSignature(); |
|
195 | + return $GLOBALS['TBE_MODULES']['_configuration'][$moduleSignature] ?? []; |
|
196 | + } |
|
197 | + |
|
198 | + /** |
|
199 | + * @return string |
|
200 | + */ |
|
201 | + protected function computeMainModule(): string |
|
202 | + { |
|
203 | + $existingConfiguration = $this->getExistingInternalConfiguration(); |
|
204 | + |
|
205 | + if ($this->mainModule !== null) { |
|
206 | + $mainModule = $this->mainModule; |
|
207 | + } elseif (!empty($existingConfiguration['mainModule'])) { // existing configuration may override. |
|
208 | + $mainModule = $existingConfiguration['mainModule']; |
|
209 | + } else { |
|
210 | + $mainModule = self::DEFAULT_MAIN_MODULE; //default value. |
|
211 | + } |
|
212 | + return $mainModule; |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * @return string |
|
217 | + */ |
|
218 | + protected function computeDefaultPid(): string |
|
219 | + { |
|
220 | + $existingConfiguration = $this->getExistingInternalConfiguration(); |
|
221 | + |
|
222 | + if ($this->defaultPid !== null) { |
|
223 | + $defaultPid = $this->defaultPid; |
|
224 | + } elseif (!empty($existingConfiguration['defaultPid'])) { // existing configuration may override. |
|
225 | + $defaultPid = $existingConfiguration['defaultPid']; |
|
226 | + } else { |
|
227 | + $defaultPid = self::DEFAULT_PID; //default value. |
|
228 | + } |
|
229 | + return $defaultPid; |
|
230 | + } |
|
231 | + |
|
232 | + /** |
|
233 | + * @return array |
|
234 | + */ |
|
235 | + protected function computeAdditionalJavaScriptFiles(): array |
|
236 | + { |
|
237 | + $additionalJavaScriptFiles = $this->additionalJavaScriptFiles; |
|
238 | + |
|
239 | + // Possible merge of existing javascript files. |
|
240 | + $existingConfiguration = $this->getExistingInternalConfiguration(); |
|
241 | + if (!empty($existingConfiguration['additionalJavaScriptFiles'])) { |
|
242 | + $additionalJavaScriptFiles = array_merge($additionalJavaScriptFiles, $existingConfiguration['additionalJavaScriptFiles']); |
|
243 | + } |
|
244 | + |
|
245 | + return $additionalJavaScriptFiles; |
|
246 | + } |
|
247 | + |
|
248 | + /** |
|
249 | + * @return array |
|
250 | + */ |
|
251 | + protected function computeAdditionalStyleSheetFiles(): array |
|
252 | + { |
|
253 | + $additionalStyleSheetFiles = $this->additionalStyleSheetFiles; |
|
254 | + |
|
255 | + // Possible merge of existing style sheets. |
|
256 | + $existingConfiguration = $this->getExistingInternalConfiguration(); |
|
257 | + if (!empty($existingConfiguration['additionalStyleSheetFiles'])) { |
|
258 | + $additionalStyleSheetFiles = array_merge($additionalStyleSheetFiles, $existingConfiguration['additionalStyleSheetFiles']); |
|
259 | + } |
|
260 | + |
|
261 | + return $additionalStyleSheetFiles; |
|
262 | + } |
|
263 | + |
|
264 | + /** |
|
265 | + * @return array |
|
266 | + */ |
|
267 | + protected function computeComponents(): array |
|
268 | + { |
|
269 | + // We override the config in any case. See if we need more than that. |
|
270 | + return $this->components; |
|
271 | + } |
|
272 | + |
|
273 | + /** |
|
274 | + * Register the module in two places: core + vidi internal. |
|
275 | + * |
|
276 | + * @return $this |
|
277 | + */ |
|
278 | + public function register(): self |
|
279 | + { |
|
280 | + // Internal Vidi module registration. |
|
281 | + $configuration = []; |
|
282 | + $configuration['dataType'] = $this->dataType; |
|
283 | + $configuration['mainModule'] = $this->computeMainModule(); |
|
284 | + $configuration['defaultPid'] = $this->computeDefaultPid(); |
|
285 | + $configuration['additionalJavaScriptFiles'] = $this->computeAdditionalJavaScriptFiles(); |
|
286 | + $configuration['additionalStyleSheetFiles'] = $this->computeAdditionalStyleSheetFiles(); |
|
287 | + $configuration['components'] = $this->computeComponents(); |
|
288 | + $configuration['isPidIgnored'] = $this->isPidIgnored; |
|
289 | + |
|
290 | + $internalModuleSignature = $this->getInternalModuleSignature(); |
|
291 | + $GLOBALS['TBE_MODULES_EXT']['vidi'][$internalModuleSignature] = $configuration; |
|
292 | + |
|
293 | + // Core module registration. |
|
294 | + // Register and displays module in the BE only if told, default is "true". |
|
295 | + if ($this->isShown) { |
|
296 | + $moduleConfiguration = []; |
|
297 | + #$moduleConfiguration['routeTarget'] = \Fab\Vidi\Controller\ContentController::class . '::mainAction', // what to do here? |
|
298 | + $moduleConfiguration['access'] = $this->getAccess(); |
|
299 | + $moduleConfiguration['labels'] = $this->getModuleLanguageFile(); |
|
300 | + $icon = $this->getIcon(); |
|
301 | + if ($icon) { |
|
302 | + $moduleConfiguration['icon'] = $icon; |
|
303 | + } |
|
304 | + |
|
305 | + if ($this->showPageTree) { |
|
306 | + $moduleConfiguration['navigationComponentId'] = 'TYPO3/CMS/Backend/PageTree/PageTreeElement'; |
|
307 | + $moduleConfiguration['inheritNavigationComponentFromMainModule'] = true; |
|
308 | + } else { |
|
309 | + $moduleConfiguration['inheritNavigationComponentFromMainModule'] = true; |
|
310 | + } |
|
311 | + |
|
312 | + ExtensionUtility::registerModule( |
|
313 | + 'Vidi', |
|
314 | + $this->computeMainModule(), |
|
315 | + $this->dataType . '_' . $this->moduleKey, |
|
316 | + $this->position, |
|
317 | + [ |
|
318 | + ContentController::class => 'index, list, delete, update, edit, copy, move, localize, sort, copyClipboard, moveClipboard', |
|
319 | + ToolController::class => 'welcome, work', |
|
320 | + FacetController::class => 'autoSuggest, autoSuggests', |
|
321 | + SelectionController::class => 'edit, update, create, delete, list, show', |
|
322 | + UserPreferencesController::class => 'save', |
|
323 | + ClipboardController::class => 'save, flush, show', |
|
324 | + ], |
|
325 | + $moduleConfiguration |
|
326 | + ); |
|
327 | + } |
|
328 | + return $this; |
|
329 | + } |
|
330 | + |
|
331 | + /** |
|
332 | + * Return the module code for a BE module. |
|
333 | + * |
|
334 | + * @return string |
|
335 | + */ |
|
336 | + public function getSignature(): string |
|
337 | + { |
|
338 | + $signature = GeneralUtility::_GP(Parameter::MODULE); |
|
339 | + $trimmedSignature = trim($signature, '/'); |
|
340 | + return str_replace(['/', 'module_'], ['_', ''], $trimmedSignature); |
|
341 | + } |
|
342 | + |
|
343 | + /** |
|
344 | + * Returns the current pid. |
|
345 | + * |
|
346 | + * @return int |
|
347 | + */ |
|
348 | + public function getCurrentPid(): int |
|
349 | + { |
|
350 | + return GeneralUtility::_GET(Parameter::PID) > 0 ? (int)GeneralUtility::_GET(Parameter::PID) : 0; |
|
351 | + } |
|
352 | + |
|
353 | + /** |
|
354 | + * Return the module URL. |
|
355 | + * |
|
356 | + * @param array $additionalParameters |
|
357 | + * @return string |
|
358 | + */ |
|
359 | + public function getModuleUrl(array $additionalParameters = []): string |
|
360 | + { |
|
361 | + $moduleCode = $this->getSignature(); |
|
362 | + |
|
363 | + // And don't forget the pid! |
|
364 | + if (GeneralUtility::_GET(Parameter::PID)) { |
|
365 | + $additionalParameters[Parameter::PID] = GeneralUtility::_GET(Parameter::PID); |
|
366 | + } |
|
367 | + |
|
368 | + return BackendUtility::getModuleUrl($moduleCode, $additionalParameters); |
|
369 | + } |
|
370 | + |
|
371 | + /** |
|
372 | + * Return the parameter prefix for a BE module. |
|
373 | + * |
|
374 | + * @return string |
|
375 | + */ |
|
376 | + public function getParameterPrefix(): string |
|
377 | + { |
|
378 | + return 'tx_vidi_' . strtolower($this->getSignature()); |
|
379 | + } |
|
380 | + |
|
381 | + /** |
|
382 | + * Return a configuration key or the entire module configuration array if not key is given. |
|
383 | + * |
|
384 | + * @param string $key |
|
385 | + * @return mixed |
|
386 | + */ |
|
387 | + public function getModuleConfiguration($key = '') |
|
388 | + { |
|
389 | + $vidiModuleCode = $this->getSignature(); |
|
390 | + |
|
391 | + // Module code must exist |
|
392 | + if (empty($GLOBALS['TBE_MODULES_EXT']['vidi'][$vidiModuleCode])) { |
|
393 | + $message = sprintf('Invalid or not existing module code "%s"', $vidiModuleCode); |
|
394 | + throw new InvalidKeyInArrayException($message, 1375092053); |
|
395 | + } |
|
396 | + |
|
397 | + $result = $GLOBALS['TBE_MODULES_EXT']['vidi'][$vidiModuleCode]; |
|
398 | + |
|
399 | + if (!empty($key)) { |
|
400 | + if (isset($result[$key])) { |
|
401 | + $result = $result[$key]; |
|
402 | + } else { |
|
403 | + // key must exist |
|
404 | + $message = sprintf('Invalid key configuration "%s"', $key); |
|
405 | + throw new InvalidKeyInArrayException($message, 1375092054); |
|
406 | + } |
|
407 | + } |
|
408 | + return $result; |
|
409 | + } |
|
410 | + |
|
411 | + /** |
|
412 | + * @param string $icon |
|
413 | + * @return $this |
|
414 | + */ |
|
415 | + public function setIcon($icon): self |
|
416 | + { |
|
417 | + $this->icon = $icon; |
|
418 | + return $this; |
|
419 | + } |
|
420 | + |
|
421 | + /** |
|
422 | + * @return string |
|
423 | + */ |
|
424 | + protected function getIcon(): string |
|
425 | + { |
|
426 | + $moduleConfiguration = $this->getExistingMainConfiguration(); |
|
427 | + |
|
428 | + if ($this->icon) { |
|
429 | + $icon = $this->icon; |
|
430 | + } else { |
|
431 | + $icon = $moduleConfiguration['icon'] ?? ''; |
|
432 | + } |
|
433 | + |
|
434 | + return $icon; |
|
435 | + } |
|
436 | + |
|
437 | + /** |
|
438 | + * @param string $mainModule |
|
439 | + * @return $this |
|
440 | + */ |
|
441 | + public function setMainModule($mainModule): self |
|
442 | + { |
|
443 | + $this->mainModule = $mainModule; |
|
444 | + return $this; |
|
445 | + } |
|
446 | + |
|
447 | + /** |
|
448 | + * @return string |
|
449 | + */ |
|
450 | + public function getMainModule(): string |
|
451 | + { |
|
452 | + if ($this->mainModule === null) { |
|
453 | + $this->mainModule = $this->getModuleConfiguration('mainModule'); |
|
454 | + } |
|
455 | + return $this->mainModule; |
|
456 | + } |
|
457 | + |
|
458 | + /** |
|
459 | + * @param string $moduleLanguageFile |
|
460 | + * @return $this |
|
461 | + */ |
|
462 | + public function setModuleLanguageFile($moduleLanguageFile): self |
|
463 | + { |
|
464 | + $this->moduleLanguageFile = $moduleLanguageFile; |
|
465 | + return $this; |
|
466 | + } |
|
467 | + |
|
468 | + /** |
|
469 | + * @param string $component |
|
470 | + * @return $this |
|
471 | + */ |
|
472 | + public function removeComponentFromDocHeader(string $component): self |
|
473 | + { |
|
474 | + foreach ($this->components[ModulePosition::DOC_HEADER] as $verticalPosition => $docHeaders) { |
|
475 | + foreach ($docHeaders as $horizontalPosition => $docHeader) { |
|
476 | + $index = array_search($component, $docHeader, true); |
|
477 | + if ($index !== false) { |
|
478 | + // $verticalPosition: top or bottom |
|
479 | + // $horizontalPosition: left or right |
|
480 | + unset($this->components[ModulePosition::DOC_HEADER][$verticalPosition][$horizontalPosition][$index]); |
|
481 | + } |
|
482 | + } |
|
483 | + } |
|
484 | + return $this; |
|
485 | + } |
|
486 | + |
|
487 | + /** |
|
488 | + * @param bool $isPidIgnored |
|
489 | + * @return $this |
|
490 | + */ |
|
491 | + public function ignorePid(bool $isPidIgnored): self |
|
492 | + { |
|
493 | + $this->isPidIgnored = $isPidIgnored; |
|
494 | + return $this; |
|
495 | + } |
|
496 | + |
|
497 | + /** |
|
498 | + * @return bool |
|
499 | + */ |
|
500 | + public function isPidIgnored(): bool |
|
501 | + { |
|
502 | + return $this->getModuleConfiguration('isPidIgnored'); |
|
503 | + } |
|
504 | + |
|
505 | + /** |
|
506 | + * @param string $component |
|
507 | + * @return bool |
|
508 | + */ |
|
509 | + public function hasComponentInDocHeader(string $component): bool |
|
510 | + { |
|
511 | + foreach ($this->getModuleConfiguration('components')[ModulePosition::DOC_HEADER] as $verticalPosition => $docHeaders) { |
|
512 | + foreach ($docHeaders as $horizontalPosition => $docHeader) { |
|
513 | + $index = array_search($component, $docHeader, true); |
|
514 | + if ($index !== false) { |
|
515 | + return true; |
|
516 | + } |
|
517 | + } |
|
518 | + } |
|
519 | + return false; |
|
520 | + } |
|
521 | + |
|
522 | + /** |
|
523 | + * @return string |
|
524 | + */ |
|
525 | + protected function getModuleLanguageFile(): string |
|
526 | + { |
|
527 | + $moduleConfiguration = $this->getExistingMainConfiguration(); |
|
528 | + |
|
529 | + if ($this->moduleLanguageFile) { |
|
530 | + $moduleLanguageFile = $this->moduleLanguageFile; |
|
531 | + } elseif ($moduleConfiguration['labels']) { // existing configuration may override. |
|
532 | + $moduleLanguageFile = $moduleConfiguration['labels']; |
|
533 | + } else { |
|
534 | + $moduleLanguageFile = ''; //default value. |
|
535 | + } |
|
536 | + |
|
537 | + return $moduleLanguageFile; |
|
538 | + } |
|
539 | + |
|
540 | + /** |
|
541 | + * @param string $position |
|
542 | + * @return $this |
|
543 | + */ |
|
544 | + public function setPosition($position): self |
|
545 | + { |
|
546 | + $this->position = $position; |
|
547 | + return $this; |
|
548 | + } |
|
549 | + |
|
550 | + /** |
|
551 | + * @return string |
|
552 | + */ |
|
553 | + public function getPosition(): string |
|
554 | + { |
|
555 | + return $this->position; |
|
556 | + } |
|
557 | + |
|
558 | + /** |
|
559 | + * @param array $files |
|
560 | + * @return $this |
|
561 | + */ |
|
562 | + public function addJavaScriptFiles(array $files): self |
|
563 | + { |
|
564 | + foreach ($files as $file) { |
|
565 | + $this->additionalJavaScriptFiles[] = $file; |
|
566 | + } |
|
567 | + return $this; |
|
568 | + } |
|
569 | + |
|
570 | + /** |
|
571 | + * @param string $fileNameAndPath |
|
572 | + * @return $this |
|
573 | + */ |
|
574 | + public function addJavaScriptFile($fileNameAndPath): self |
|
575 | + { |
|
576 | + $this->additionalJavaScriptFiles[] = $fileNameAndPath; |
|
577 | + return $this; |
|
578 | + } |
|
579 | + |
|
580 | + /** |
|
581 | + * @param array $files |
|
582 | + * @return $this |
|
583 | + */ |
|
584 | + public function addStyleSheetFiles(array $files): self |
|
585 | + { |
|
586 | + foreach ($files as $file) { |
|
587 | + $this->additionalStyleSheetFiles[] = $file; |
|
588 | + } |
|
589 | + return $this; |
|
590 | + } |
|
591 | + |
|
592 | + /** |
|
593 | + * @param string $fileNameAndPath |
|
594 | + * @return $this |
|
595 | + */ |
|
596 | + public function addStyleSheetFile($fileNameAndPath): self |
|
597 | + { |
|
598 | + $this->additionalStyleSheetFiles[] = $fileNameAndPath; |
|
599 | + return $this; |
|
600 | + } |
|
601 | + |
|
602 | + /** |
|
603 | + * @return string |
|
604 | + */ |
|
605 | + public function getDataType(): string |
|
606 | + { |
|
607 | + if ($this->dataType === null) { |
|
608 | + $this->dataType = $this->getModuleConfiguration('dataType'); |
|
609 | + } |
|
610 | + return $this->dataType; |
|
611 | + } |
|
612 | + |
|
613 | + /** |
|
614 | + * @return array |
|
615 | + */ |
|
616 | + public function getDataTypes(): array |
|
617 | + { |
|
618 | + $dataTypes = []; |
|
619 | + foreach ($GLOBALS['TBE_MODULES_EXT']['vidi'] as $module) { |
|
620 | + $dataTypes[] = $module['dataType']; |
|
621 | + } |
|
622 | + return $dataTypes; |
|
623 | + } |
|
624 | + |
|
625 | + /** |
|
626 | + * @param string $dataType |
|
627 | + * @return $this |
|
628 | + */ |
|
629 | + public function setDataType($dataType): self |
|
630 | + { |
|
631 | + $this->dataType = $dataType; |
|
632 | + return $this; |
|
633 | + } |
|
634 | + |
|
635 | + /** |
|
636 | + * @return int |
|
637 | + */ |
|
638 | + public function getDefaultPid(): int |
|
639 | + { |
|
640 | + if (empty($this->defaultPid)) { |
|
641 | + $this->defaultPid = $this->getModuleConfiguration('defaultPid'); |
|
642 | + } |
|
643 | + return (int)$this->defaultPid; |
|
644 | + } |
|
645 | + |
|
646 | + /** |
|
647 | + * @param string $defaultPid |
|
648 | + * @return $this |
|
649 | + */ |
|
650 | + public function setDefaultPid($defaultPid): self |
|
651 | + { |
|
652 | + $this->defaultPid = $defaultPid; |
|
653 | + return $this; |
|
654 | + } |
|
655 | + |
|
656 | + /** |
|
657 | + * @param bool $isPageTreeShown |
|
658 | + * @return $this |
|
659 | + */ |
|
660 | + public function showPageTree($isPageTreeShown): self |
|
661 | + { |
|
662 | + $this->showPageTree = $isPageTreeShown; |
|
663 | + return $this; |
|
664 | + } |
|
665 | + |
|
666 | + /** |
|
667 | + * @param string $isShown |
|
668 | + * @return $this |
|
669 | + */ |
|
670 | + public function isShown($isShown): self |
|
671 | + { |
|
672 | + $this->isShown = $isShown; |
|
673 | + return $this; |
|
674 | + } |
|
675 | + |
|
676 | + /** |
|
677 | + * @return $array |
|
678 | + */ |
|
679 | + public function getDocHeaderTopLeftComponents() |
|
680 | + { |
|
681 | + $configuration = $this->getModuleConfiguration(); |
|
682 | + return $configuration['components'][ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::LEFT]; |
|
683 | + } |
|
684 | + |
|
685 | + /** |
|
686 | + * @param array $components |
|
687 | + * @return $this |
|
688 | + */ |
|
689 | + public function setDocHeaderTopLeftComponents(array $components): self |
|
690 | + { |
|
691 | + $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::LEFT] = $components; |
|
692 | + return $this; |
|
693 | + } |
|
694 | + |
|
695 | + /** |
|
696 | + * @param string|array $components |
|
697 | + * @return $this |
|
698 | + */ |
|
699 | + public function addDocHeaderTopLeftComponents($components): self |
|
700 | + { |
|
701 | + if (is_string($components)) { |
|
702 | + $components = [$components]; |
|
703 | + } |
|
704 | + $currentComponents = $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::LEFT]; |
|
705 | + $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::LEFT] = array_merge($currentComponents, $components); |
|
706 | + return $this; |
|
707 | + } |
|
708 | + |
|
709 | + /** |
|
710 | + * @return $array |
|
711 | + */ |
|
712 | + public function getDocHeaderTopRightComponents() |
|
713 | + { |
|
714 | + $configuration = $this->getModuleConfiguration(); |
|
715 | + return $configuration['components'][ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::RIGHT]; |
|
716 | + } |
|
717 | + |
|
718 | + /** |
|
719 | + * @param array $components |
|
720 | + * @return $this |
|
721 | + */ |
|
722 | + public function setDocHeaderTopRightComponents(array $components): self |
|
723 | + { |
|
724 | + $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::RIGHT] = $components; |
|
725 | + return $this; |
|
726 | + } |
|
727 | + |
|
728 | + /** |
|
729 | + * @param string|array $components |
|
730 | + * @return $this |
|
731 | + */ |
|
732 | + public function addDocHeaderTopRightComponents($components): self |
|
733 | + { |
|
734 | + if (is_string($components)) { |
|
735 | + $components = [$components]; |
|
736 | + } |
|
737 | + $currentComponents = $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::RIGHT]; |
|
738 | + $this->components[ModulePosition::DOC_HEADER][ModulePosition::TOP][ModulePosition::RIGHT] = array_merge($currentComponents, $components); |
|
739 | + return $this; |
|
740 | + } |
|
741 | + |
|
742 | + /** |
|
743 | + * @return $array |
|
744 | + */ |
|
745 | + public function getDocHeaderBottomLeftComponents() |
|
746 | + { |
|
747 | + $configuration = $this->getModuleConfiguration(); |
|
748 | + return $configuration['components'][ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::LEFT]; |
|
749 | + } |
|
750 | + |
|
751 | + /** |
|
752 | + * @param array $components |
|
753 | + * @return $this |
|
754 | + */ |
|
755 | + public function setDocHeaderBottomLeftComponents(array $components): self |
|
756 | + { |
|
757 | + $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::LEFT] = $components; |
|
758 | + return $this; |
|
759 | + } |
|
760 | + |
|
761 | + /** |
|
762 | + * @param string|array $components |
|
763 | + * @return $this |
|
764 | + */ |
|
765 | + public function addDocHeaderBottomLeftComponents($components): self |
|
766 | + { |
|
767 | + if (is_string($components)) { |
|
768 | + $components = [$components]; |
|
769 | + } |
|
770 | + $currentComponents = $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::LEFT]; |
|
771 | + $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::LEFT] = array_merge($currentComponents, $components); |
|
772 | + return $this; |
|
773 | + } |
|
774 | + |
|
775 | + /** |
|
776 | + * @return $array |
|
777 | + */ |
|
778 | + public function getDocHeaderBottomRightComponents() |
|
779 | + { |
|
780 | + $configuration = $this->getModuleConfiguration(); |
|
781 | + return $configuration['components'][ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::RIGHT]; |
|
782 | + } |
|
783 | + |
|
784 | + /** |
|
785 | + * @param array $components |
|
786 | + * @return $this |
|
787 | + */ |
|
788 | + public function setDocHeaderBottomRightComponents(array $components): self |
|
789 | + { |
|
790 | + $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::RIGHT] = $components; |
|
791 | + return $this; |
|
792 | + } |
|
793 | + |
|
794 | + /** |
|
795 | + * @param string|array $components |
|
796 | + * @return $this |
|
797 | + */ |
|
798 | + public function addDocHeaderBottomRightComponents($components): self |
|
799 | + { |
|
800 | + if (is_string($components)) { |
|
801 | + $components = [$components]; |
|
802 | + } |
|
803 | + $currentComponents = $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::RIGHT]; |
|
804 | + $this->components[ModulePosition::DOC_HEADER][ModulePosition::BOTTOM][ModulePosition::RIGHT] = array_merge($currentComponents, $components); |
|
805 | + return $this; |
|
806 | + } |
|
807 | + |
|
808 | + /** |
|
809 | + * @return $array |
|
810 | + */ |
|
811 | + public function getGridTopComponents() |
|
812 | + { |
|
813 | + $configuration = $this->getModuleConfiguration(); |
|
814 | + return $configuration['components'][ModulePosition::GRID][ModulePosition::TOP]; |
|
815 | + } |
|
816 | + |
|
817 | + /** |
|
818 | + * @param array $components |
|
819 | + * @return $this |
|
820 | + */ |
|
821 | + public function setGridTopComponents(array $components): self |
|
822 | + { |
|
823 | + $this->components[ModulePosition::GRID][ModulePosition::TOP] = $components; |
|
824 | + return $this; |
|
825 | + } |
|
826 | + |
|
827 | + /** |
|
828 | + * @param string|array $components |
|
829 | + * @return $this |
|
830 | + */ |
|
831 | + public function addGridTopComponents($components): self |
|
832 | + { |
|
833 | + if (is_string($components)) { |
|
834 | + $components = [$components]; |
|
835 | + } |
|
836 | + $currentComponents = $this->components[ModulePosition::GRID][ModulePosition::TOP]; |
|
837 | + $this->components[ModulePosition::GRID][ModulePosition::TOP] = array_merge($currentComponents, $components); |
|
838 | + return $this; |
|
839 | + } |
|
840 | + |
|
841 | + /** |
|
842 | + * @return mixed $array |
|
843 | + */ |
|
844 | + public function getGridBottomComponents() |
|
845 | + { |
|
846 | + $configuration = $this->getModuleConfiguration(); |
|
847 | + return $configuration['components'][ModulePosition::GRID][ModulePosition::BOTTOM]; |
|
848 | + } |
|
849 | + |
|
850 | + /** |
|
851 | + * @param array $components |
|
852 | + * @return $this |
|
853 | + */ |
|
854 | + public function setGridBottomComponents(array $components): self |
|
855 | + { |
|
856 | + $this->components[ModulePosition::GRID][ModulePosition::BOTTOM] = $components; |
|
857 | + return $this; |
|
858 | + } |
|
859 | + |
|
860 | + /** |
|
861 | + * @param string|array $components |
|
862 | + * @return $this |
|
863 | + */ |
|
864 | + public function addGridBottomComponents($components): self |
|
865 | + { |
|
866 | + if (is_string($components)) { |
|
867 | + $components = [$components]; |
|
868 | + } |
|
869 | + $currentComponents = $this->components[ModulePosition::GRID][ModulePosition::BOTTOM]; |
|
870 | + $this->components[ModulePosition::GRID][ModulePosition::BOTTOM] = array_merge($currentComponents, $components); |
|
871 | + return $this; |
|
872 | + } |
|
873 | + |
|
874 | + /** |
|
875 | + * @return $array |
|
876 | + */ |
|
877 | + public function getGridButtonsComponents() |
|
878 | + { |
|
879 | + $configuration = $this->getModuleConfiguration(); |
|
880 | + return $configuration['components'][ModulePosition::GRID][ModulePosition::BUTTONS]; |
|
881 | + } |
|
882 | + |
|
883 | + /** |
|
884 | + * @param array $components |
|
885 | + * @return $this |
|
886 | + */ |
|
887 | + public function setGridButtonsComponents(array $components): self |
|
888 | + { |
|
889 | + $this->components[ModulePosition::GRID][ModulePosition::BUTTONS] = $components; |
|
890 | + return $this; |
|
891 | + } |
|
892 | + |
|
893 | + /** |
|
894 | + * @param string|array $components |
|
895 | + * @return $this |
|
896 | + */ |
|
897 | + public function addGridButtonsComponents($components): self |
|
898 | + { |
|
899 | + if (is_string($components)) { |
|
900 | + $components = [$components]; |
|
901 | + } |
|
902 | + $currentComponents = $this->components[ModulePosition::GRID][ModulePosition::BUTTONS]; |
|
903 | + $this->components[ModulePosition::GRID][ModulePosition::BUTTONS] = array_merge($components, $currentComponents); |
|
904 | + return $this; |
|
905 | + } |
|
906 | + |
|
907 | + /** |
|
908 | + * @return $array |
|
909 | + */ |
|
910 | + public function getMenuMassActionComponents() |
|
911 | + { |
|
912 | + $configuration = $this->getModuleConfiguration(); |
|
913 | + return $configuration['components'][ModulePosition::MENU_MASS_ACTION]; |
|
914 | + } |
|
915 | + |
|
916 | + /** |
|
917 | + * @param array $components |
|
918 | + * @return $this |
|
919 | + */ |
|
920 | + public function setMenuMassActionComponents(array $components): self |
|
921 | + { |
|
922 | + $this->components[ModulePosition::MENU_MASS_ACTION] = $components; |
|
923 | + return $this; |
|
924 | + } |
|
925 | + |
|
926 | + /** |
|
927 | + * @param string|array $components |
|
928 | + * @return $this |
|
929 | + */ |
|
930 | + public function addMenuMassActionComponents($components): self |
|
931 | + { |
|
932 | + if (is_string($components)) { |
|
933 | + $components = [$components]; |
|
934 | + } |
|
935 | + $currentComponents = $this->components[ModulePosition::MENU_MASS_ACTION]; |
|
936 | + $this->components[ModulePosition::MENU_MASS_ACTION] = array_merge($components, $currentComponents); |
|
937 | + return $this; |
|
938 | + } |
|
939 | + |
|
940 | + /** |
|
941 | + * @return string |
|
942 | + */ |
|
943 | + protected function getAccess(): string |
|
944 | + { |
|
945 | + $moduleConfiguration = $this->getExistingMainConfiguration(); |
|
946 | + |
|
947 | + if ($this->access !== null) { |
|
948 | + $access = $this->access; |
|
949 | + } elseif (!empty($moduleConfiguration['access'])) { // existing configuration may override. |
|
950 | + $access = $moduleConfiguration['access']; |
|
951 | + } else { |
|
952 | + $access = Access::USER; //default value. |
|
953 | + } |
|
954 | + return $access; |
|
955 | + } |
|
956 | + |
|
957 | + /** |
|
958 | + * @param string $access |
|
959 | + * @return $this |
|
960 | + */ |
|
961 | + public function setAccess($access): self |
|
962 | + { |
|
963 | + $this->access = $access; |
|
964 | + return $this; |
|
965 | + } |
|
966 | + |
|
967 | + /** |
|
968 | + * @return \string[] |
|
969 | + */ |
|
970 | + public function getAdditionalJavaScriptFiles(): array |
|
971 | + { |
|
972 | + if (empty($this->additionalJavaScriptFiles)) { |
|
973 | + $this->additionalJavaScriptFiles = $this->getModuleConfiguration('additionalJavaScriptFiles'); |
|
974 | + } |
|
975 | + return $this->additionalJavaScriptFiles; |
|
976 | + } |
|
977 | + |
|
978 | + /** |
|
979 | + * @return \string[] |
|
980 | + */ |
|
981 | + public function getAdditionalStyleSheetFiles(): array |
|
982 | + { |
|
983 | + if (empty($this->additionalStyleSheetFiles)) { |
|
984 | + $this->additionalStyleSheetFiles = $this->getModuleConfiguration('additionalStyleSheetFiles'); |
|
985 | + } |
|
986 | + return $this->additionalStyleSheetFiles; |
|
987 | + } |
|
988 | + |
|
989 | + /** |
|
990 | + * @return array |
|
991 | + */ |
|
992 | + public function getComponents(): array |
|
993 | + { |
|
994 | + return $this->components; |
|
995 | + } |
|
996 | + |
|
997 | + /** |
|
998 | + * @param string $pluginName |
|
999 | + * @return bool |
|
1000 | + */ |
|
1001 | + public function hasPlugin($pluginName = ''): bool |
|
1002 | + { |
|
1003 | + $parameterPrefix = $this->getParameterPrefix(); |
|
1004 | + $parameters = GeneralUtility::_GET($parameterPrefix); |
|
1005 | + |
|
1006 | + $hasPlugin = !empty($parameters['plugins']) && is_array($parameters['plugins']); |
|
1007 | + if ($hasPlugin && $pluginName) { |
|
1008 | + $hasPlugin = in_array($pluginName, $parameters['plugins']); |
|
1009 | + } |
|
1010 | + return $hasPlugin; |
|
1011 | + } |
|
1012 | + |
|
1013 | + /** |
|
1014 | + * Compute the internal module code |
|
1015 | + * |
|
1016 | + * @param null|string $dataType |
|
1017 | + * @return string |
|
1018 | + */ |
|
1019 | + protected function getInternalModuleSignature($dataType = null): string |
|
1020 | + { |
|
1021 | + // Else we forge the module signature |
|
1022 | + if ($dataType === null) { |
|
1023 | + $dataType = $this->dataType; |
|
1024 | + } |
|
1025 | + $subModuleName = $dataType . '_' . $this->moduleKey; |
|
1026 | + |
|
1027 | + $mainModule = $this->mainModule ?: self::DEFAULT_MAIN_MODULE; |
|
1028 | + return $mainModule . '_Vidi' . GeneralUtility::underscoredToUpperCamelCase($subModuleName); |
|
1029 | + } |
|
1030 | 1030 | } |
@@ -16,19 +16,19 @@ |
||
16 | 16 | */ |
17 | 17 | class ModulePosition extends Enumeration |
18 | 18 | { |
19 | - public const DOC_HEADER = 'doc-header'; |
|
19 | + public const DOC_HEADER = 'doc-header'; |
|
20 | 20 | |
21 | - public const TOP = 'top'; |
|
21 | + public const TOP = 'top'; |
|
22 | 22 | |
23 | - public const BOTTOM = 'bottom'; |
|
23 | + public const BOTTOM = 'bottom'; |
|
24 | 24 | |
25 | - public const LEFT = 'left'; |
|
25 | + public const LEFT = 'left'; |
|
26 | 26 | |
27 | - public const RIGHT = 'right'; |
|
27 | + public const RIGHT = 'right'; |
|
28 | 28 | |
29 | - public const GRID = 'grid'; |
|
29 | + public const GRID = 'grid'; |
|
30 | 30 | |
31 | - public const BUTTONS = 'buttons'; |
|
31 | + public const BUTTONS = 'buttons'; |
|
32 | 32 | |
33 | - public const MENU_MASS_ACTION = 'menu-mass-action'; |
|
33 | + public const MENU_MASS_ACTION = 'menu-mass-action'; |
|
34 | 34 | } |
@@ -20,105 +20,105 @@ |
||
20 | 20 | */ |
21 | 21 | class ModuleService implements SingletonInterface |
22 | 22 | { |
23 | - /** |
|
24 | - * @var array |
|
25 | - */ |
|
26 | - protected $storage = []; |
|
23 | + /** |
|
24 | + * @var array |
|
25 | + */ |
|
26 | + protected $storage = []; |
|
27 | 27 | |
28 | - /** |
|
29 | - * Returns a class instance |
|
30 | - * |
|
31 | - * @return \Fab\Vidi\Module\ModuleService|object |
|
32 | - */ |
|
33 | - public static function getInstance() |
|
34 | - { |
|
35 | - return GeneralUtility::makeInstance(\Fab\Vidi\Module\ModuleService::class); |
|
36 | - } |
|
28 | + /** |
|
29 | + * Returns a class instance |
|
30 | + * |
|
31 | + * @return \Fab\Vidi\Module\ModuleService|object |
|
32 | + */ |
|
33 | + public static function getInstance() |
|
34 | + { |
|
35 | + return GeneralUtility::makeInstance(\Fab\Vidi\Module\ModuleService::class); |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * Fetch all modules to be displayed on the current pid. |
|
40 | - * |
|
41 | - * @return array |
|
42 | - */ |
|
43 | - public function getModulesForCurrentPid(): array |
|
44 | - { |
|
45 | - $pid = $this->getModuleLoader()->getCurrentPid(); |
|
46 | - return $this->getModulesForPid($pid); |
|
47 | - } |
|
38 | + /** |
|
39 | + * Fetch all modules to be displayed on the current pid. |
|
40 | + * |
|
41 | + * @return array |
|
42 | + */ |
|
43 | + public function getModulesForCurrentPid(): array |
|
44 | + { |
|
45 | + $pid = $this->getModuleLoader()->getCurrentPid(); |
|
46 | + return $this->getModulesForPid($pid); |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * Fetch all modules displayed given a pid. |
|
51 | - * |
|
52 | - * @param int $pid |
|
53 | - * @return array |
|
54 | - */ |
|
55 | - public function getModulesForPid($pid = null): array |
|
56 | - { |
|
57 | - if (!isset($this->storage[$pid])) { |
|
58 | - $modules = []; |
|
59 | - foreach ($GLOBALS['TCA'] as $dataType => $configuration) { |
|
60 | - if (Tca::table($dataType)->isNotHidden()) { |
|
61 | - $record = $this->getDataService()->getRecord( |
|
62 | - $dataType, |
|
63 | - [ |
|
64 | - 'pid' => $pid |
|
65 | - ] |
|
66 | - ); |
|
67 | - if (!empty($record)) { |
|
68 | - $moduleName = 'Vidi' . GeneralUtility::underscoredToUpperCamelCase($dataType) . 'M1'; |
|
69 | - $title = Tca::table($dataType)->getTitle(); |
|
70 | - $modules[$moduleName] = $title; |
|
71 | - } |
|
72 | - } |
|
73 | - } |
|
74 | - $this->storage[$pid] = $modules; |
|
75 | - } |
|
76 | - return $this->storage[$pid]; |
|
77 | - } |
|
49 | + /** |
|
50 | + * Fetch all modules displayed given a pid. |
|
51 | + * |
|
52 | + * @param int $pid |
|
53 | + * @return array |
|
54 | + */ |
|
55 | + public function getModulesForPid($pid = null): array |
|
56 | + { |
|
57 | + if (!isset($this->storage[$pid])) { |
|
58 | + $modules = []; |
|
59 | + foreach ($GLOBALS['TCA'] as $dataType => $configuration) { |
|
60 | + if (Tca::table($dataType)->isNotHidden()) { |
|
61 | + $record = $this->getDataService()->getRecord( |
|
62 | + $dataType, |
|
63 | + [ |
|
64 | + 'pid' => $pid |
|
65 | + ] |
|
66 | + ); |
|
67 | + if (!empty($record)) { |
|
68 | + $moduleName = 'Vidi' . GeneralUtility::underscoredToUpperCamelCase($dataType) . 'M1'; |
|
69 | + $title = Tca::table($dataType)->getTitle(); |
|
70 | + $modules[$moduleName] = $title; |
|
71 | + } |
|
72 | + } |
|
73 | + } |
|
74 | + $this->storage[$pid] = $modules; |
|
75 | + } |
|
76 | + return $this->storage[$pid]; |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Fetch the first module for the current pid. |
|
81 | - * |
|
82 | - * @return string |
|
83 | - */ |
|
84 | - public function getFirstModuleForCurrentPid(): string |
|
85 | - { |
|
86 | - $pid = $this->getModuleLoader()->getCurrentPid(); |
|
87 | - return $this->getFirstModuleForPid($pid); |
|
88 | - } |
|
79 | + /** |
|
80 | + * Fetch the first module for the current pid. |
|
81 | + * |
|
82 | + * @return string |
|
83 | + */ |
|
84 | + public function getFirstModuleForCurrentPid(): string |
|
85 | + { |
|
86 | + $pid = $this->getModuleLoader()->getCurrentPid(); |
|
87 | + return $this->getFirstModuleForPid($pid); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Fetch the module given a pid. |
|
92 | - * |
|
93 | - * @param int $pid |
|
94 | - * @return string |
|
95 | - */ |
|
96 | - public function getFirstModuleForPid($pid): string |
|
97 | - { |
|
98 | - $firstModule = ''; |
|
99 | - $modules = $this->getModulesForPid($pid); |
|
100 | - if (!empty($modules)) { |
|
101 | - $firstModule = key($modules); |
|
102 | - } |
|
90 | + /** |
|
91 | + * Fetch the module given a pid. |
|
92 | + * |
|
93 | + * @param int $pid |
|
94 | + * @return string |
|
95 | + */ |
|
96 | + public function getFirstModuleForPid($pid): string |
|
97 | + { |
|
98 | + $firstModule = ''; |
|
99 | + $modules = $this->getModulesForPid($pid); |
|
100 | + if (!empty($modules)) { |
|
101 | + $firstModule = key($modules); |
|
102 | + } |
|
103 | 103 | |
104 | - return $firstModule; |
|
105 | - } |
|
104 | + return $firstModule; |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * @return object|DataService |
|
109 | - */ |
|
110 | - protected function getDataService(): DataService |
|
111 | - { |
|
112 | - return GeneralUtility::makeInstance(DataService::class); |
|
113 | - } |
|
107 | + /** |
|
108 | + * @return object|DataService |
|
109 | + */ |
|
110 | + protected function getDataService(): DataService |
|
111 | + { |
|
112 | + return GeneralUtility::makeInstance(DataService::class); |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Get the Vidi Module Loader. |
|
117 | - * |
|
118 | - * @return ModuleLoader|object |
|
119 | - */ |
|
120 | - protected function getModuleLoader() |
|
121 | - { |
|
122 | - return GeneralUtility::makeInstance(ModuleLoader::class); |
|
123 | - } |
|
115 | + /** |
|
116 | + * Get the Vidi Module Loader. |
|
117 | + * |
|
118 | + * @return ModuleLoader|object |
|
119 | + */ |
|
120 | + protected function getModuleLoader() |
|
121 | + { |
|
122 | + return GeneralUtility::makeInstance(ModuleLoader::class); |
|
123 | + } |
|
124 | 124 | } |
@@ -14,23 +14,23 @@ |
||
14 | 14 | */ |
15 | 15 | class ConfigurablePart |
16 | 16 | { |
17 | - public const __default = ''; |
|
18 | - public const EXCLUDED_FIELDS = 'excluded_fields'; |
|
19 | - public const MENU_VISIBLE_ITEMS = 'menuVisibleItems'; |
|
20 | - public const MENU_VISIBLE_ITEMS_DEFAULT = 'menuVisibleItemsDefault'; |
|
17 | + public const __default = ''; |
|
18 | + public const EXCLUDED_FIELDS = 'excluded_fields'; |
|
19 | + public const MENU_VISIBLE_ITEMS = 'menuVisibleItems'; |
|
20 | + public const MENU_VISIBLE_ITEMS_DEFAULT = 'menuVisibleItemsDefault'; |
|
21 | 21 | |
22 | - /** |
|
23 | - * Get the valid values for this enum. |
|
24 | - * |
|
25 | - * @param boolean $include_default |
|
26 | - * @return array |
|
27 | - */ |
|
28 | - public static function getParts($include_default = false) |
|
29 | - { |
|
30 | - return array( |
|
31 | - 'EXCLUDED_FIELDS' => self::EXCLUDED_FIELDS, |
|
32 | - 'MENU_VISIBLE_ITEMS' => self::MENU_VISIBLE_ITEMS, |
|
33 | - 'MENU_VISIBLE_ITEMS_DEFAULT' => self::MENU_VISIBLE_ITEMS_DEFAULT, |
|
34 | - ); |
|
35 | - } |
|
22 | + /** |
|
23 | + * Get the valid values for this enum. |
|
24 | + * |
|
25 | + * @param boolean $include_default |
|
26 | + * @return array |
|
27 | + */ |
|
28 | + public static function getParts($include_default = false) |
|
29 | + { |
|
30 | + return array( |
|
31 | + 'EXCLUDED_FIELDS' => self::EXCLUDED_FIELDS, |
|
32 | + 'MENU_VISIBLE_ITEMS' => self::MENU_VISIBLE_ITEMS, |
|
33 | + 'MENU_VISIBLE_ITEMS_DEFAULT' => self::MENU_VISIBLE_ITEMS_DEFAULT, |
|
34 | + ); |
|
35 | + } |
|
36 | 36 | } |
@@ -17,68 +17,68 @@ |
||
17 | 17 | */ |
18 | 18 | class DataHandlerFactory implements SingletonInterface |
19 | 19 | { |
20 | - /** |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - protected $actionName = ''; |
|
20 | + /** |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + protected $actionName = ''; |
|
24 | 24 | |
25 | - /** |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - protected $dataType = ''; |
|
25 | + /** |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + protected $dataType = ''; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Default is CoreDataHandler which wraps the Core DataHandler. |
|
32 | - * |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - protected $defaultDataHandler = 'Fab\Vidi\DataHandler\CoreDataHandler'; |
|
30 | + /** |
|
31 | + * Default is CoreDataHandler which wraps the Core DataHandler. |
|
32 | + * |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + protected $defaultDataHandler = 'Fab\Vidi\DataHandler\CoreDataHandler'; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @param string $actionName |
|
39 | - * @return $this |
|
40 | - */ |
|
41 | - public function action($actionName) |
|
42 | - { |
|
43 | - $this->actionName = $actionName; |
|
44 | - return $this; |
|
45 | - } |
|
37 | + /** |
|
38 | + * @param string $actionName |
|
39 | + * @return $this |
|
40 | + */ |
|
41 | + public function action($actionName) |
|
42 | + { |
|
43 | + $this->actionName = $actionName; |
|
44 | + return $this; |
|
45 | + } |
|
46 | 46 | |
47 | - /** |
|
48 | - * @param string $dataType |
|
49 | - * @return $this |
|
50 | - */ |
|
51 | - public function forType($dataType) |
|
52 | - { |
|
53 | - $this->dataType = $dataType; |
|
54 | - return $this; |
|
55 | - } |
|
47 | + /** |
|
48 | + * @param string $dataType |
|
49 | + * @return $this |
|
50 | + */ |
|
51 | + public function forType($dataType) |
|
52 | + { |
|
53 | + $this->dataType = $dataType; |
|
54 | + return $this; |
|
55 | + } |
|
56 | 56 | |
57 | - /** |
|
58 | - * Returns a Data Handler instance. |
|
59 | - * |
|
60 | - * @throws \Exception |
|
61 | - * @return DataHandlerInterface |
|
62 | - */ |
|
63 | - public function getDataHandler() |
|
64 | - { |
|
65 | - if (empty($this->dataType)) { |
|
66 | - throw new \Exception('Attribute $this->dataType can not be empty', 1410001035); |
|
67 | - } |
|
57 | + /** |
|
58 | + * Returns a Data Handler instance. |
|
59 | + * |
|
60 | + * @throws \Exception |
|
61 | + * @return DataHandlerInterface |
|
62 | + */ |
|
63 | + public function getDataHandler() |
|
64 | + { |
|
65 | + if (empty($this->dataType)) { |
|
66 | + throw new \Exception('Attribute $this->dataType can not be empty', 1410001035); |
|
67 | + } |
|
68 | 68 | |
69 | - if (empty($this->actionName)) { |
|
70 | - throw new \Exception('Attribute $this->actionName can not be empty', 1410001036); |
|
71 | - } |
|
69 | + if (empty($this->actionName)) { |
|
70 | + throw new \Exception('Attribute $this->actionName can not be empty', 1410001036); |
|
71 | + } |
|
72 | 72 | |
73 | - if (isset($GLOBALS['TCA'][$this->dataType]['vidi']['data_handler'][$this->actionName])) { |
|
74 | - $className = $GLOBALS['TCA'][$this->dataType]['vidi']['data_handler'][$this->actionName]; |
|
75 | - } elseif (isset($GLOBALS['TCA'][$this->dataType]['vidi']['data_handler']['*'])) { |
|
76 | - $className = $GLOBALS['TCA'][$this->dataType]['vidi']['data_handler']['*']; |
|
77 | - } else { |
|
78 | - $className = $this->defaultDataHandler; |
|
79 | - } |
|
73 | + if (isset($GLOBALS['TCA'][$this->dataType]['vidi']['data_handler'][$this->actionName])) { |
|
74 | + $className = $GLOBALS['TCA'][$this->dataType]['vidi']['data_handler'][$this->actionName]; |
|
75 | + } elseif (isset($GLOBALS['TCA'][$this->dataType]['vidi']['data_handler']['*'])) { |
|
76 | + $className = $GLOBALS['TCA'][$this->dataType]['vidi']['data_handler']['*']; |
|
77 | + } else { |
|
78 | + $className = $this->defaultDataHandler; |
|
79 | + } |
|
80 | 80 | |
81 | - $dataHandler = GeneralUtility::makeInstance($className); |
|
82 | - return $dataHandler; |
|
83 | - } |
|
81 | + $dataHandler = GeneralUtility::makeInstance($className); |
|
82 | + return $dataHandler; |
|
83 | + } |
|
84 | 84 | } |
@@ -15,18 +15,18 @@ |
||
15 | 15 | */ |
16 | 16 | abstract class AbstractDataHandler implements DataHandlerInterface, SingletonInterface |
17 | 17 | { |
18 | - /** |
|
19 | - * @var array |
|
20 | - */ |
|
21 | - protected $errorMessages = []; |
|
18 | + /** |
|
19 | + * @var array |
|
20 | + */ |
|
21 | + protected $errorMessages = []; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Return error that have occurred while processing the data. |
|
25 | - * |
|
26 | - * @return array |
|
27 | - */ |
|
28 | - public function getErrorMessages() |
|
29 | - { |
|
30 | - return $this->errorMessages; |
|
31 | - } |
|
23 | + /** |
|
24 | + * Return error that have occurred while processing the data. |
|
25 | + * |
|
26 | + * @return array |
|
27 | + */ |
|
28 | + public function getErrorMessages() |
|
29 | + { |
|
30 | + return $this->errorMessages; |
|
31 | + } |
|
32 | 32 | } |