• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CPS-IT / personio-jobs / 15388375997

02 Jun 2025 09:09AM UTC coverage: 3.654% (+0.04%) from 3.61%
15388375997

push

github

web-flow
Merge pull request #228 from CPS-IT/task/drop-v11

[!!!][TASK] Drop support for TYPO3 v11.5

0 of 8 new or added lines in 5 files covered. (0.0%)

6 existing lines in 5 files now uncovered.

27 of 739 relevant lines covered (3.65%)

0.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/Classes/Configuration/Tca.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "personio_jobs".
7
 *
8
 * Copyright (C) 2023 Elias Häußler <e.haeussler@familie-redlich.de>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace CPSIT\Typo3PersonioJobs\Configuration;
25

26
use CPSIT\Typo3PersonioJobs\Extension;
27
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
28
use TYPO3\CMS\Core\Utility\GeneralUtility;
29
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
30

31
/**
32
 * Tca
33
 *
34
 * @author Elias Häußler <e.haeussler@familie-redlich.de>
35
 * @license GPL-2.0-or-later
36
 */
37
final class Tca
38
{
39
    /**
40
     * @param list<string|\BackedEnum> $itemValues
41
     * @return list<array{string, string}>|list<array{label: string, value: string}>
42
     */
43
    public static function mapItems(
×
44
        string $tableName,
45
        string $fieldName,
46
        array $itemValues,
47
        bool $allowEmpty = false,
48
    ): array {
49
        $items = [];
×
50

51
        if ($allowEmpty) {
×
52
            $items[] = self::resolveItem('', '');
×
53
        }
54

55
        foreach ($itemValues as $itemValue) {
×
56
            if ($itemValue instanceof \BackedEnum) {
×
57
                $itemValue = (string)$itemValue->value;
×
58
            }
59

60
            $items[] = self::resolveItem(
×
61
                'LLL:EXT:personio_jobs/Resources/Private/Language/locallang_db.xlf:' . $tableName . '.' . $fieldName . '.' . $itemValue,
×
62
                $itemValue,
×
63
            );
×
64
        }
65

66
        return $items;
×
67
    }
68

69
    public static function addPlugin(
×
70
        string $name,
71
        ?string $icon = null,
72
        ?string $flexForm = null,
73
    ): void {
74
        $pluginSignature = self::buildPluginSignature($name);
×
75

76
        ExtensionUtility::registerPlugin(
×
77
            Extension::KEY,
×
78
            $name,
×
79
            'LLL:EXT:personio_jobs/Resources/Private/Language/locallang_db.xlf:plugins.' . lcfirst($name),
×
80
            $icon,
×
81
            'personio',
×
82
        );
×
83

84
        if ($flexForm !== null) {
×
85
            ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, $flexForm);
×
86

87
            $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
×
88
        }
89
    }
90

91
    /**
92
     * @return array{label: string, value: string}
93
     */
94
    private static function resolveItem(string $label, string $value): array
×
95
    {
NEW
96
        return [
×
97
            'label' => $label,
×
98
            'value' => $value,
×
99
        ];
×
100
    }
101

102
    private static function buildPluginSignature(string $pluginName): string
×
103
    {
104
        $extensionName = GeneralUtility::underscoredToUpperCamelCase(Extension::KEY);
×
105

106
        return strtolower($extensionName . '_' . $pluginName);
×
107
    }
108
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc