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

FluidTYPO3 / flux / 15918415903

20 May 2025 10:36AM UTC coverage: 91.109% (-2.1%) from 93.21%
15918415903

push

github

NamelessCoder
[TASK] Lock phpstan version

6927 of 7603 relevant lines covered (91.11%)

9.53 hits per line

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

98.65
/Classes/Form/AbstractInlineFormField.php
1
<?php
2
namespace FluidTYPO3\Flux\Form;
3

4
/*
5
 * This file is part of the FluidTYPO3/Flux project under GPLv2 or later.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.md file that was distributed with this source code.
9
 */
10

11
use FluidTYPO3\Flux\Enum\InlineFieldControls;
12
use FluidTYPO3\Flux\Enum\InlineFieldNewRecordButtonPosition;
13
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
14

15
abstract class AbstractInlineFormField extends AbstractRelationFormField implements InlineRelationFieldInterface
16
{
17
    /**
18
     * If true, all child records are shown as collapsed.
19
     */
20
    protected bool $collapseAll = false;
21

22
    /**
23
     * Show only one expanded record at any time. If a new record is expanded,
24
     * all others are collapsed.
25
     */
26
    protected bool $expandSingle = false;
27

28
    /**
29
     * Add the foreign table's title to the 'Add new' link (ie. 'Add new (sometable)')
30
     */
31
    protected bool $newRecordLinkAddTitle = false;
32

33
    /**
34
     * Record link position - can be either \FluidTYPO3\Flux\Form::POSITION_TOP,
35
     * \FluidTYPO3\Flux\Form::POSITION_BOTTOM, \FluidTYPO3\Flux\Form::POSITION_BOTH or
36
     * \FluidTYPO3\Flux\Form::POSITION_NONE.
37
     */
38
    protected string $newRecordLinkPosition = InlineFieldNewRecordButtonPosition::TOP;
39

40
    /**
41
     * For use on bidirectional relations using an intermediary table.
42
     * In combinations, it's possible to edit attributes and the related child record.
43
     */
44
    protected bool $useCombination = false;
45

46
    /**
47
     * Allow manual sorting of child objects.
48
     */
49
    protected bool $useSortable = false;
50

51
    /**
52
     * Show unlocalized records which are in the original language, but not yet localized.
53
     */
54
    protected bool $showPossibleLocalizationRecords = false;
55

56
    /**
57
     * Show records which were once localized but do not exist in the original
58
     * language anymore.
59
     */
60
    protected bool $showRemovedLocalizationRecords = false;
61

62
    /**
63
     * Defines whether to show the 'localize all records' link to fetch untranslated
64
     * records from the original language.
65
     */
66
    protected bool $showAllLocalizationLink = false;
67

68
    /**
69
     * Defines whether to show a 'synchronize' link to update to a 1:1 translation with
70
     * the original language.
71
     */
72
    protected bool $showSynchronizationLink = false;
73

74
    /**
75
     * Associative array with the keys 'info', 'new', 'dragdrop', 'sort', 'hide', delete'
76
     * and 'localize'. Set either one to TRUE or FALSE to show or hide it.
77
     */
78
    protected array $enabledControls = [
79
        InlineFieldControls::INFO => false,
80
        InlineFieldControls::NEW => true,
81
        InlineFieldControls::DRAGDROP => true,
82
        InlineFieldControls::SORT => true,
83
        InlineFieldControls::HIDE => true,
84
        InlineFieldControls::DELETE => false,
85
        InlineFieldControls::LOCALIZE => false,
86
    ];
87

88
    /**
89
     * Array of field=>value pairs which are always used in conditions as well as inserted into new
90
     * records created through this form component.
91
     */
92
    protected array $foreignMatchFields = [];
93
    protected ?array $headerThumbnail = null;
94
    protected ?string $levelLinksPosition = null;
95
    protected array $overrideChildTca = [];
96
    protected array $foreignTypes = [];
97

98
    public function prepareConfiguration(string $type): array
99
    {
100
        $configuration = parent::prepareConfiguration($type);
5✔
101
        $configuration['foreign_match_fields'] = $this->getForeignMatchFields();
5✔
102
        $configuration['overrideChildTca'] = $this->getOverrideChildTca();
5✔
103
        $configuration['foreign_types'] = $this->getForeignTypes();
5✔
104
        $configuration['appearance'] = [
5✔
105
            'collapseAll' => $this->getCollapseAll(),
5✔
106
            'expandSingle' => $this->getExpandSingle(),
5✔
107
            'newRecordLinkAddTitle' => $this->getNewRecordLinkAddTitle(),
5✔
108
            'newRecordLinkPosition' => $this->getNewRecordLinkPosition(),
5✔
109
            'useCombination' => $this->getUseCombination(),
5✔
110
            'useSortable' => $this->getUseSortable(),
5✔
111
            'showPossibleLocalizationRecords' => $this->getShowPossibleLocalizationRecords(),
5✔
112
            'showRemovedLocalizationRecords' => $this->getShowRemovedLocalizationRecords(),
5✔
113
            'showAllLocalizationLink' => $this->getShowAllLocalizationLink(),
5✔
114
            'showSynchronizationLink' => $this->getShowSynchronizationLink(),
5✔
115
            'enabledControls' => $this->getEnabledControls(),
5✔
116
            'headerThumbnail' => $this->getHeaderThumbnail(),
5✔
117
            'levelLinksPosition' => $this->getLevelLinksPosition(),
5✔
118
        ];
5✔
119
        if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '12.0', '>=')) {
5✔
120
            unset($configuration['appearance']['showRemovedLocalizationRecords']);
×
121
        }
122

123
        $configuration['behaviour'] = [
5✔
124
            'localizationMode' => $this->getLocalizationMode(),
5✔
125
            'disableMovingChildrenWithParent' => $this->getDisableMovingChildrenWithParent(),
5✔
126
        ];
5✔
127
        return $configuration;
5✔
128
    }
129

130
    public function setCollapseAll(bool $collapseAll): self
131
    {
132
        $this->collapseAll = $collapseAll;
26✔
133
        return $this;
26✔
134
    }
135

136
    public function getCollapseAll(): bool
137
    {
138
        return $this->collapseAll;
7✔
139
    }
140

141
    public function setEnabledControls(array $enabledControls): self
142
    {
143
        $this->enabledControls = $enabledControls;
20✔
144
        return $this;
20✔
145
    }
146

147
    public function getEnabledControls(): array
148
    {
149
        return $this->enabledControls;
7✔
150
    }
151

152
    public function setExpandSingle(bool $expandSingle): self
153
    {
154
        $this->expandSingle = $expandSingle;
26✔
155
        return $this;
26✔
156
    }
157

158
    public function getExpandSingle(): bool
159
    {
160
        return $this->expandSingle;
7✔
161
    }
162

163
    public function setNewRecordLinkAddTitle(bool $newRecordLinkAddTitle): self
164
    {
165
        $this->newRecordLinkAddTitle = $newRecordLinkAddTitle;
26✔
166
        return $this;
26✔
167
    }
168

169
    public function getNewRecordLinkAddTitle(): bool
170
    {
171
        return $this->newRecordLinkAddTitle;
7✔
172
    }
173

174
    public function setNewRecordLinkPosition(string $newRecordLinkPosition): self
175
    {
176
        $this->newRecordLinkPosition = $newRecordLinkPosition;
26✔
177
        return $this;
26✔
178
    }
179

180
    public function getNewRecordLinkPosition(): string
181
    {
182
        return $this->newRecordLinkPosition;
7✔
183
    }
184

185
    public function setShowAllLocalizationLink(bool $showAllLocalizationLink): self
186
    {
187
        $this->showAllLocalizationLink = $showAllLocalizationLink;
26✔
188
        return $this;
26✔
189
    }
190

191
    public function getShowAllLocalizationLink(): bool
192
    {
193
        return $this->showAllLocalizationLink;
7✔
194
    }
195

196
    public function setShowPossibleLocalizationRecords(bool $showPossibleLocalizationRecords): self
197
    {
198
        $this->showPossibleLocalizationRecords = $showPossibleLocalizationRecords;
26✔
199
        return $this;
26✔
200
    }
201

202
    public function getShowPossibleLocalizationRecords(): bool
203
    {
204
        return $this->showPossibleLocalizationRecords;
7✔
205
    }
206

207
    public function setShowRemovedLocalizationRecords(bool $showRemovedLocalizationRecords): self
208
    {
209
        $this->showRemovedLocalizationRecords = $showRemovedLocalizationRecords;
26✔
210
        return $this;
26✔
211
    }
212

213
    public function getShowRemovedLocalizationRecords(): bool
214
    {
215
        return $this->showRemovedLocalizationRecords;
7✔
216
    }
217

218
    public function setShowSynchronizationLink(bool $showSynchronizationLink): self
219
    {
220
        $this->showSynchronizationLink = $showSynchronizationLink;
26✔
221
        return $this;
26✔
222
    }
223

224
    public function getShowSynchronizationLink(): bool
225
    {
226
        return $this->showSynchronizationLink;
7✔
227
    }
228

229
    public function setUseCombination(bool $useCombination): self
230
    {
231
        $this->useCombination = $useCombination;
26✔
232
        return $this;
26✔
233
    }
234

235
    public function getUseCombination(): bool
236
    {
237
        return $this->useCombination;
7✔
238
    }
239

240
    public function setUseSortable(bool $useSortable): self
241
    {
242
        $this->useSortable = $useSortable;
26✔
243
        return $this;
26✔
244
    }
245

246
    public function getUseSortable(): bool
247
    {
248
        return $this->useSortable;
7✔
249
    }
250

251
    public function setForeignMatchFields(array $foreignMatchFields): self
252
    {
253
        $this->foreignMatchFields = $foreignMatchFields;
6✔
254
        return $this;
6✔
255
    }
256

257
    public function getForeignMatchFields(): array
258
    {
259
        return $this->foreignMatchFields;
6✔
260
    }
261

262
    public function setHeaderThumbnail(array $headerThumbnail): self
263
    {
264
        $this->headerThumbnail = $headerThumbnail;
1✔
265
        return $this;
1✔
266
    }
267

268
    public function getHeaderThumbnail(): ?array
269
    {
270
        return $this->headerThumbnail;
6✔
271
    }
272

273
    public function setLevelLinksPosition(?string $levelLinksPosition): self
274
    {
275
        $this->levelLinksPosition = $levelLinksPosition;
8✔
276
        return $this;
8✔
277
    }
278

279
    public function getLevelLinksPosition(): ?string
280
    {
281
        return $this->levelLinksPosition;
5✔
282
    }
283

284
    public function setOverrideChildTca(array $overrideChildTca): self
285
    {
286
        $this->overrideChildTca = $overrideChildTca;
6✔
287
        return $this;
6✔
288
    }
289

290
    public function getOverrideChildTca():array
291
    {
292
        return $this->overrideChildTca;
5✔
293
    }
294

295
    public function setForeignTypes(array $foreignTypes): self
296
    {
297
        $this->foreignTypes = $foreignTypes;
17✔
298
        return $this;
17✔
299
    }
300

301
    public function getForeignTypes(): array
302
    {
303
        return $this->foreignTypes;
6✔
304
    }
305
}
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