1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Loading TypeConverter. |
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 HDNET\Autoloader\Utility\ClassNamingUtility; |
13
|
|
|
use HDNET\Autoloader\Utility\FileUtility; |
14
|
|
|
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; |
15
|
|
|
use TYPO3\CMS\Extbase\Utility\ExtensionUtility; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Loading TypeConverter. |
19
|
|
|
*/ |
20
|
|
|
class TypeConverter implements LoaderInterface |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* Get all the complex data for the loader. |
24
|
|
|
* This return value will be cached and stored in the database |
25
|
|
|
* There is no file monitoring for this cache. |
26
|
|
|
*/ |
27
|
|
|
public function prepareLoader(Loader $loader, int $type): array |
28
|
|
|
{ |
29
|
|
|
$classes = []; |
30
|
|
|
$converterPath = ExtensionManagementUtility::extPath($loader->getExtensionKey()) . 'Classes/Property/TypeConverter/'; |
31
|
|
|
$converterClasses = FileUtility::getBaseFilesRecursivelyInDir($converterPath, 'php', true); |
32
|
|
|
|
33
|
|
|
foreach ($converterClasses as $converterClass) { |
34
|
|
|
$converterClass = ClassNamingUtility::getFqnByPath( |
35
|
|
|
$loader->getVendorName(), |
36
|
|
|
$loader->getExtensionKey(), |
37
|
|
|
'Property/TypeConverter/' . $converterClass |
38
|
|
|
); |
39
|
|
|
if ($loader->isInstantiableClass($converterClass)) { |
40
|
|
|
$classes[] = $converterClass; |
41
|
|
|
} |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
return $classes; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Run the loading process for the ext_tables.php file. |
49
|
|
|
*/ |
50
|
|
|
public function loadExtensionTables(Loader $autoLoader, array $loaderInformation): void |
51
|
|
|
{ |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Run the loading process for the ext_localconf.php file. |
56
|
|
|
*/ |
57
|
|
|
public function loadExtensionConfiguration(Loader $autoLoader, array $loaderInformation): void |
58
|
|
|
{ |
59
|
|
|
foreach ($loaderInformation as $class) { |
60
|
|
|
ExtensionUtility::registerTypeConverter($class); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|