TcaManipulation::processData()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 1 Features 0
Metric Value
c 4
b 1
f 0
dl 0
loc 13
rs 9.4285
cc 2
eloc 9
nc 2
nop 0
1
<?php
2
/**
3
 * Add TCA settings
4
 *
5
 * @author  Tim Lochmüller
6
 */
7
8
namespace HDNET\Tagger\Hooks;
9
10
use HDNET\Autoloader\Utility\TranslateUtility;
11
use HDNET\Tagger\Service\IntegrationService;
12
use HDNET\Tagger\Utility\TaggerRegister;
13
use TYPO3\CMS\Core\Database\TableConfigurationPostProcessingHookInterface;
14
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
15
16
/**
17
 * Add TCA settings
18
 *
19
 * @hook TYPO3_CONF_VARS|SC_OPTIONS|GLOBAL|extTablesInclusion-PostProcessing
20
 */
21
class TcaManipulation implements TableConfigurationPostProcessingHookInterface
22
{
23
24
    /**
25
     * Add the needed TCA configuration
26
     */
27
    public function processData()
28
    {
29
        $register = TaggerRegister::getRegister();
30
        foreach ($register as $configuration) {
31
            $table = $configuration['tableName'];
32
            $GLOBALS['TCA'][$table]['columns']['tagger'] = [
33
                'exclude' => 1,
34
                'label'   => TranslateUtility::getLllOrHelpMessage('tags', 'tagger'),
35
                'config'  => IntegrationService::getTagFieldConfiguration($table)
36
            ];
37
            ExtensionManagementUtility::addToAllTCAtypes($table, 'tagger');
38
        }
39
    }
40
}
41