|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Fab\Vidi\View\Check; |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* This file is part of the Fab/Vidi project under GPLv2 or later. |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please read the |
|
9
|
|
|
* LICENSE.md file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
use Fab\Vidi\Module\ModulePidService; |
|
13
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
14
|
|
|
use Fab\Vidi\View\AbstractComponentView; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Class PidCheck |
|
18
|
|
|
* @deprecated |
|
19
|
|
|
*/ |
|
20
|
|
|
class PidCheck extends AbstractComponentView |
|
21
|
|
|
{ |
|
22
|
|
|
/** |
|
23
|
|
|
* Renders warnings if storagePid is not properly configured. |
|
24
|
|
|
* |
|
25
|
|
|
* @return string |
|
26
|
|
|
*/ |
|
27
|
|
|
public function render(): string |
|
28
|
|
|
{ |
|
29
|
|
|
$errors = $this->getModulePidService()->validateConfiguredPid(); |
|
30
|
|
|
|
|
31
|
|
|
return empty($errors) |
|
32
|
|
|
? '' |
|
33
|
|
|
: $this->formatMessagePidIsNotValid($errors); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Format a message whenever the storage is offline. |
|
38
|
|
|
* |
|
39
|
|
|
* @param array $errors |
|
40
|
|
|
* @return string |
|
41
|
|
|
*/ |
|
42
|
|
|
protected function formatMessagePidIsNotValid(array $errors): string |
|
43
|
|
|
{ |
|
44
|
|
|
$configuredPid = $this->getModulePidService()->getConfiguredNewRecordPid(); |
|
45
|
|
|
|
|
46
|
|
|
$error = implode('<br />', $errors); |
|
47
|
|
|
$dataType = $this->getModuleLoader()->getDataType(); |
|
48
|
|
|
$result = <<< EOF |
|
49
|
|
|
<div class="alert alert-warning"> |
|
50
|
|
|
<div class="alert-title"> |
|
51
|
|
|
Page id "{$configuredPid}" has found to be a wrong configuration for "{$dataType}" |
|
52
|
|
|
</div> |
|
53
|
|
|
<div class="alert-message"> |
|
54
|
|
|
<p>{$error}</p> |
|
55
|
|
|
New records cannot be created with this page id. The configuration can be changed at different levels: |
|
56
|
|
|
<ul> |
|
57
|
|
|
<li>Settings in the Extension Manager as fallback configuration.</li> |
|
58
|
|
|
<li>In some ext_tables.php file, by allowing this record type on any pages.<br /> |
|
59
|
|
|
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('{$dataType}') |
|
60
|
|
|
</li> |
|
61
|
|
|
<li>By User TSconfig:</li> |
|
62
|
|
|
</ul> |
|
63
|
|
|
<pre> |
|
64
|
|
|
# User TSconfig to be placed in your ext_tables.php: |
|
65
|
|
|
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' |
|
66
|
|
|
|
|
67
|
|
|
# Default pid for "{$dataType}" in Vidi: |
|
68
|
|
|
tx_vidi.dataType.{$dataType}.storagePid = xx |
|
69
|
|
|
'); |
|
70
|
|
|
</pre> |
|
71
|
|
|
|
|
72
|
|
|
</div> |
|
73
|
|
|
</div> |
|
74
|
|
|
EOF; |
|
75
|
|
|
|
|
76
|
|
|
return $result; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @return ModulePidService|object |
|
81
|
|
|
*/ |
|
82
|
|
|
public function getModulePidService() |
|
83
|
|
|
{ |
|
84
|
|
|
/** @var ModulePidService $modulePidService */ |
|
85
|
|
|
return GeneralUtility::makeInstance(ModulePidService::class); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
} |
|
89
|
|
|
|