-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathPanelLayoutHelpTextProvider.php
More file actions
48 lines (43 loc) · 1.48 KB
/
PanelLayoutHelpTextProvider.php
File metadata and controls
48 lines (43 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
declare(strict_types=1);
namespace MetaModels\CoreBundle\BackendHelp;
use ContaoCommunityAlliance\DcGeneral\BackendHelp\BackendHelpProviderInterface;
use ContaoCommunityAlliance\DcGeneral\BackendHelp\HelpText;
final readonly class PanelLayoutHelpTextProvider implements BackendHelpProviderInterface
{
public function __construct(
private BackendHelpProviderInterface $previous,
) {
}
#[\Override]
public function getHelpFor(string $table, string $property): iterable
{
$buffer = [];
foreach ($this->previous->getHelpFor($table, $property) as $helpText) {
$buffer[$helpText->getSection() . '_' . $helpText->getKey()] = true;
yield $helpText;
}
if ('tl_metamodel_dca' === $table && 'panelLayout' === $property) {
foreach (
[
'filter',
'search',
'sort',
'limit',
] as $option
) {
$helpText = new HelpText(
'panelLayout_headline',
$option,
'panelLayout_' . $option . '.caption',
'panelLayout_' . $option . '.description',
'tl_metamodel_dca',
);
if ($buffer[$helpText->getSection() . '_' . $helpText->getKey()] ?? false) {
continue;
}
yield $helpText;
}
}
}
}