|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Tca UserFunctions. |
|
5
|
|
|
*/ |
|
6
|
|
|
declare(strict_types = 1); |
|
7
|
|
|
|
|
8
|
|
|
namespace HDNET\Autoloader\UserFunctions; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Tca UserFunctions. |
|
12
|
|
|
*/ |
|
13
|
|
|
class Tca |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* Generate the help message for array fields. |
|
17
|
|
|
* |
|
18
|
|
|
* @param array $configuration |
|
19
|
|
|
* @param object $formEngine FormEngine object |
|
20
|
|
|
* |
|
21
|
|
|
* @return string |
|
22
|
|
|
*/ |
|
23
|
|
|
public function arrayInfoField($configuration, $formEngine) |
|
|
|
|
|
|
24
|
|
|
{ |
|
25
|
|
|
return $this->generateGenericRelationMessage($configuration); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Generate the help message for object storage fields. |
|
30
|
|
|
* |
|
31
|
|
|
* @param array $configuration |
|
32
|
|
|
* @param object $formEngine FormEngine object |
|
33
|
|
|
* |
|
34
|
|
|
* @return string |
|
35
|
|
|
*/ |
|
36
|
|
|
public function objectStorageInfoField($configuration, $formEngine) |
|
|
|
|
|
|
37
|
|
|
{ |
|
38
|
|
|
return $this->generateGenericRelationMessage($configuration); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Generate the help message for model fields. |
|
43
|
|
|
* |
|
44
|
|
|
* @param array $configuration |
|
45
|
|
|
* @param object $formEngine FormEngine object |
|
46
|
|
|
* |
|
47
|
|
|
* @return string |
|
48
|
|
|
*/ |
|
49
|
|
|
public function modelInfoField($configuration, $formEngine) |
|
|
|
|
|
|
50
|
|
|
{ |
|
51
|
|
|
return $this->generateGenericRelationMessage($configuration); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Get a generic text for an info box. |
|
56
|
|
|
* |
|
57
|
|
|
* @param array $configuration |
|
58
|
|
|
* |
|
59
|
|
|
* @return string |
|
60
|
|
|
*/ |
|
61
|
|
|
protected function generateGenericRelationMessage($configuration) |
|
62
|
|
|
{ |
|
63
|
|
|
$infoField = '<strong>Please configure your TCA for this field.</strong><br/>'; |
|
64
|
|
|
$infoField .= 'You see this message because you have NOT configured the TCA.'; |
|
65
|
|
|
$infoField .= '<ul><li>table: <em>' . $configuration['table'] . '</em></li>'; |
|
66
|
|
|
$infoField .= '<li>field: <em>' . $configuration['field'] . '</em></li>'; |
|
67
|
|
|
$infoField .= '<li>config-file'; |
|
68
|
|
|
$infoField .= '<ul><li>own table: <em>Configuration/TCA/' . $configuration['table'] . '.php</em></li>'; |
|
69
|
|
|
$infoField .= '<li>foreign table: <em>Configuration/TCA/Overrides/' . $configuration['table'] . '.php</em></li></ul>'; |
|
70
|
|
|
$infoField .= '</li></ul>'; |
|
71
|
|
|
$infoField .= 'Common foreign tables are <em>tt_content</em>, <em>tt_address</em>, ….<br/><br/>'; |
|
72
|
|
|
$infoField .= 'Information about proper TCA configuration as '; |
|
73
|
|
|
$infoField .= '<a href="https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Group.html" target="_blank">group</a>, '; |
|
74
|
|
|
$infoField .= '<a href="https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Inline.html" target="_blank">inline</a> or '; |
|
75
|
|
|
$infoField .= '<a href="https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Select.html" target="_blank">select</a>'; |
|
76
|
|
|
$infoField .= '-type can be found in the TCA-documentation.<br/>'; |
|
77
|
|
|
|
|
78
|
|
|
return $this->wrapInInfoBox($infoField); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* Wrap the given content in a info box for the backend. |
|
83
|
|
|
* |
|
84
|
|
|
* @param string $content |
|
85
|
|
|
* |
|
86
|
|
|
* @return string |
|
87
|
|
|
*/ |
|
88
|
|
|
protected function wrapInInfoBox($content) |
|
89
|
|
|
{ |
|
90
|
|
|
return '<div style="padding: 5px; border: 2px solid red;">' . $content . '</div>'; |
|
91
|
|
|
} |
|
92
|
|
|
} |
|
93
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.