|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Loading Slots. |
|
5
|
|
|
*/ |
|
6
|
|
|
declare(strict_types=1); |
|
7
|
|
|
|
|
8
|
|
|
namespace HDNET\Autoloader\Loader; |
|
9
|
|
|
|
|
10
|
|
|
use HDNET\Autoloader\Loader; |
|
11
|
|
|
use HDNET\Autoloader\LoaderInterface; |
|
12
|
|
|
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; |
|
13
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Loading Slots. |
|
17
|
|
|
*/ |
|
18
|
|
|
class StaticTyposcript implements LoaderInterface |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* Get all the complex data for the loader. |
|
22
|
|
|
* This return value will be cached and stored in the database |
|
23
|
|
|
* There is no file monitoring for this cache. |
|
24
|
|
|
* |
|
25
|
|
|
* @param Loader $loader |
|
26
|
|
|
* @param int $type |
|
27
|
|
|
* |
|
28
|
|
|
* @return array |
|
29
|
|
|
*/ |
|
30
|
|
|
public function prepareLoader(Loader $loader, int $type): array |
|
31
|
|
|
{ |
|
32
|
|
|
$tsConfiguration = []; |
|
33
|
|
|
$extPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()); |
|
34
|
|
|
$baseDir = $extPath . 'Configuration/TypoScript/'; |
|
35
|
|
|
if (!\is_dir($baseDir)) { |
|
36
|
|
|
return $tsConfiguration; |
|
37
|
|
|
} |
|
38
|
|
|
$typoScriptFolder = GeneralUtility::getAllFilesAndFoldersInPath([], $baseDir, '', true, 99, '(.*)\\.(.*)'); |
|
39
|
|
|
$extensionName = GeneralUtility::underscoredToUpperCamelCase($loader->getExtensionKey()); |
|
40
|
|
|
|
|
41
|
|
|
foreach ($typoScriptFolder as $folder) { |
|
42
|
|
|
if (\is_file($folder . 'setup.txt') || \is_file($folder . 'constants.txt') || \is_file($folder . 'setup.typoscript') || \is_file($folder . 'constants.typoscript')) { |
|
43
|
|
|
$setupName = $extensionName . '/' . \str_replace($baseDir, '', $folder); |
|
44
|
|
|
$setupName = \implode(' - ', GeneralUtility::trimExplode('/', $setupName, true)); |
|
45
|
|
|
$folder = \str_replace($extPath, '', $folder); |
|
46
|
|
|
$tsConfiguration[] = [ |
|
47
|
|
|
'path' => $folder, |
|
48
|
|
|
'title' => $setupName, |
|
49
|
|
|
]; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
return $tsConfiguration; |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Run the loading process for the ext_tables.php file. |
|
58
|
|
|
* |
|
59
|
|
|
* @param Loader $loader |
|
60
|
|
|
* @param array $loaderInformation |
|
61
|
|
|
*/ |
|
62
|
|
|
public function loadExtensionTables(Loader $loader, array $loaderInformation) |
|
63
|
|
|
{ |
|
64
|
|
|
foreach ($loaderInformation as $tsConfig) { |
|
65
|
|
|
ExtensionManagementUtility::addStaticFile($loader->getExtensionKey(), $tsConfig['path'], $tsConfig['title']); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Run the loading process for the ext_localconf.php file. |
|
71
|
|
|
* |
|
72
|
|
|
* @param Loader $loader |
|
73
|
|
|
* @param array $loaderInformation |
|
74
|
|
|
*/ |
|
75
|
|
|
public function loadExtensionConfiguration(Loader $loader, array $loaderInformation) |
|
76
|
|
|
{ |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|