-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathAbstractOverridesAggregate.php
More file actions
63 lines (53 loc) · 1.99 KB
/
Copy pathAbstractOverridesAggregate.php
File metadata and controls
63 lines (53 loc) · 1.99 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
declare(strict_types=1);
namespace IchHabRecht\MaskExport\Aggregate;
/*
* This file is part of the TYPO3 extension mask_export.
*
* (c) 2016 Nicole Cordes <typo3@cordes.co>, CPS-IT GmbH
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
use TYPO3\CMS\Core\Utility\ArrayUtility;
abstract class AbstractOverridesAggregate extends AbstractAggregate implements LanguageAwareInterface, PhpAwareInterface, SqlAwareInterface
{
use PhpAwareTrait;
use SqlAwareTrait;
use TcaAwareTrait;
/**
* @var string
*/
protected $tcaOverridesFilePath = 'Configuration/TCA/Overrides/';
protected function addTableColumns(array $tableConfiguration): void
{
if (empty($tableConfiguration['columns']) || empty($this->maskConfiguration[$this->table]['tca'])) {
return;
}
$newTableFields = array_intersect_key(
$tableConfiguration['columns'],
$this->maskConfiguration[$this->table]['tca']
);
if (empty($newTableFields)) {
return;
}
ksort($newTableFields);
$newTableFields = $this->replaceFieldLabels($newTableFields, $this->table);
$newTableFields = $this->replaceItemsLabels($newTableFields, $this->table);
$this->addFieldsSqlDefinitions($newTableFields);
$tempColumns = ArrayUtility::arrayExport($newTableFields);
$this->appendPhpFile(
$this->tcaOverridesFilePath . $this->table . '.php',
<<<EOS
\$tempColumns = {$tempColumns};
\\TYPO3\\CMS\\Core\\Utility\\ExtensionManagementUtility::addTCAcolumns('{$this->table}', \$tempColumns);
EOS
,
PhpAwareInterface::PHPFILE_DEFINED_TYPO3_MODE | PhpAwareInterface::PHPFILE_CLOSURE_FUNCTION
);
}
}