Passed
Push — master ( 011f83...789882 )
by
unknown
13:51
created

InputLinkElement::render()   F

Complexity

Conditions 25
Paths 6049

Size

Total Lines 224
Code Lines 176

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 25
eloc 176
nc 6049
nop 0
dl 0
loc 224
rs 0
c 0
b 0
f 0

How to fix   Long Method    Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
/*
4
 * This file is part of the TYPO3 CMS project.
5
 *
6
 * It is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License, either version 2
8
 * of the License, or any later version.
9
 *
10
 * For the full copyright and license information, please read the
11
 * LICENSE.txt file that was distributed with this source code.
12
 *
13
 * The TYPO3 project - inspiring people to share!
14
 */
15
16
namespace TYPO3\CMS\Backend\Form\Element;
17
18
use TYPO3\CMS\Backend\Utility\BackendUtility;
19
use TYPO3\CMS\Core\Imaging\Icon;
20
use TYPO3\CMS\Core\LinkHandling\Exception\UnknownLinkHandlerException;
21
use TYPO3\CMS\Core\LinkHandling\LinkService;
22
use TYPO3\CMS\Core\Localization\LanguageService;
23
use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
24
use TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException;
25
use TYPO3\CMS\Core\Resource\Exception\InvalidPathException;
26
use TYPO3\CMS\Core\Resource\File;
27
use TYPO3\CMS\Core\Resource\Folder;
28
use TYPO3\CMS\Core\Utility\GeneralUtility;
29
use TYPO3\CMS\Core\Utility\MathUtility;
30
use TYPO3\CMS\Core\Utility\StringUtility;
31
use TYPO3\CMS\Frontend\Service\TypoLinkCodecService;
32
33
/**
34
 * Link input element.
35
 *
36
 * Shows current link and the link popup.
37
 */
38
class InputLinkElement extends AbstractFormElement
39
{
40
    /**
41
     * Default field information enabled for this element.
42
     *
43
     * @var array
44
     */
45
    protected $defaultFieldInformation = [
46
        'tcaDescription' => [
47
            'renderType' => 'tcaDescription',
48
        ],
49
    ];
50
51
    /**
52
     * Default field controls render the link icon
53
     *
54
     * @var array
55
     */
56
    protected $defaultFieldControl = [
57
        'linkPopup' => [
58
            'renderType' => 'linkPopup',
59
            'options' => []
60
        ],
61
    ];
62
63
    /**
64
     * Default field wizards enabled for this element.
65
     *
66
     * @var array
67
     */
68
    protected $defaultFieldWizard = [
69
        'localizationStateSelector' => [
70
            'renderType' => 'localizationStateSelector',
71
        ],
72
        'otherLanguageContent' => [
73
            'renderType' => 'otherLanguageContent',
74
            'after' => [
75
                'localizationStateSelector'
76
            ],
77
        ],
78
        'defaultLanguageDifferences' => [
79
            'renderType' => 'defaultLanguageDifferences',
80
            'after' => [
81
                'otherLanguageContent',
82
            ],
83
        ],
84
    ];
85
86
    /**
87
     * This will render a single-line input form field, possibly with various control/validation features
88
     *
89
     * @return array As defined in initializeResultArray() of AbstractNode
90
     */
91
    public function render()
92
    {
93
        $languageService = $this->getLanguageService();
94
95
        $table = $this->data['tableName'];
96
        $fieldName = $this->data['fieldName'];
97
        $row = $this->data['databaseRow'];
98
        $parameterArray = $this->data['parameterArray'];
99
        $resultArray = $this->initializeResultArray();
100
        $config = $parameterArray['fieldConf']['config'];
101
102
        $itemValue = $parameterArray['itemFormElValue'];
103
        $evalList = GeneralUtility::trimExplode(',', $config['eval'], true);
104
        $size = MathUtility::forceIntegerInRange($config['size'] ?? $this->defaultInputWidth, $this->minimumInputWidth, $this->maxInputWidth);
105
        $width = (int)$this->formMaxWidth($size);
106
        $nullControlNameEscaped = htmlspecialchars('control[active][' . $table . '][' . $row['uid'] . '][' . $fieldName . ']');
107
108
        $fieldInformationResult = $this->renderFieldInformation();
109
        $fieldInformationHtml = $fieldInformationResult['html'];
110
        $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
111
112
        if ($config['readOnly']) {
113
            // Early return for read only fields
114
            $html = [];
115
            $html[] = '<div class="formengine-field-item t3js-formengine-field-item">';
116
            $html[] =   $fieldInformationHtml;
117
            $html[] =   '<div class="form-wizards-wrap">';
118
            $html[] =       '<div class="form-wizards-element">';
119
            $html[] =           '<div class="form-control-wrap" style="max-width: ' . $width . 'px">';
120
            $html[] =               '<input class="form-control" value="' . htmlspecialchars($itemValue) . '" type="text" disabled>';
121
            $html[] =           '</div>';
122
            $html[] =       '</div>';
123
            $html[] =   '</div>';
124
            $html[] = '</div>';
125
            $resultArray['html'] = implode(LF, $html);
126
            return $resultArray;
127
        }
128
129
        // @todo: The whole eval handling is a mess and needs refactoring
130
        foreach ($evalList as $func) {
131
            // @todo: This is ugly: The code should find out on it's own whether an eval definition is a
132
            // @todo: keyword like "date", or a class reference. The global registration could be dropped then
133
            // Pair hook to the one in \TYPO3\CMS\Core\DataHandling\DataHandler::checkValue_input_Eval()
134
            if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func])) {
135
                if (class_exists($func)) {
136
                    $evalObj = GeneralUtility::makeInstance($func);
137
                    if (method_exists($evalObj, 'deevaluateFieldValue')) {
138
                        $_params = [
139
                            'value' => $itemValue
140
                        ];
141
                        $itemValue = $evalObj->deevaluateFieldValue($_params);
142
                    }
143
                    if (method_exists($evalObj, 'returnFieldJS')) {
144
                        $resultArray['additionalJavaScriptPost'][] = 'TBE_EDITOR.customEvalFunctions[' . GeneralUtility::quoteJSvalue($func) . ']'
145
                            . ' = function(value) {' . $evalObj->returnFieldJS() . '};';
146
                    }
147
                }
148
            }
149
        }
150
151
        $fieldId = StringUtility::getUniqueId('formengine-input-');
152
153
        $attributes = [
154
            'value' => '',
155
            'id' => $fieldId,
156
            'class' => implode(' ', [
157
                'form-control',
158
                't3js-clearable',
159
                't3js-form-field-inputlink-input',
160
                'hidden',
161
                'hasDefaultValue',
162
            ]),
163
            'data-formengine-validation-rules' => $this->getValidationDataAsJsonString($config),
164
            'data-formengine-input-params' => (string)json_encode([
165
                'field' => $parameterArray['itemFormElName'],
166
                'evalList' => implode(',', $evalList)
167
            ]),
168
            'data-formengine-input-name' => (string)($parameterArray['itemFormElName'] ?? ''),
169
        ];
170
171
        $maxLength = $config['max'] ?? 0;
172
        if ((int)$maxLength > 0) {
173
            $attributes['maxlength'] = (string)(int)$maxLength;
174
        }
175
        if (!empty($config['placeholder'])) {
176
            $attributes['placeholder'] = trim($config['placeholder']);
177
        }
178
        if (isset($config['autocomplete'])) {
179
            $attributes['autocomplete'] = empty($config['autocomplete']) ? 'new-' . $fieldName : 'on';
180
        }
181
182
        $valuePickerHtml = [];
183
        if (isset($config['valuePicker']['items']) && is_array($config['valuePicker']['items'])) {
184
            $mode = $config['valuePicker']['mode'] ?? '';
185
            $itemName = $parameterArray['itemFormElName'];
186
            $fieldChangeFunc = $parameterArray['fieldChangeFunc'];
187
            if ($mode === 'append') {
188
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
189
                    . '.value=\'\'+this.options[this.selectedIndex].value+document.editform[' . GeneralUtility::quoteJSvalue($itemName) . '].value';
190
            } elseif ($mode === 'prepend') {
191
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
192
                    . '.value+=\'\'+this.options[this.selectedIndex].value';
193
            } else {
194
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
195
                    . '.value=this.options[this.selectedIndex].value';
196
            }
197
            $valuePickerHtml[] = '<select';
198
            $valuePickerHtml[] =  ' class="form-select"';
199
            $valuePickerHtml[] =  ' onchange="' . htmlspecialchars($assignValue . ';this.blur();this.selectedIndex=0;' . implode('', $fieldChangeFunc)) . '"';
200
            $valuePickerHtml[] = '>';
201
            $valuePickerHtml[] = '<option></option>';
202
            foreach ($config['valuePicker']['items'] as $item) {
203
                $valuePickerHtml[] = '<option value="' . htmlspecialchars($item[1]) . '">' . htmlspecialchars($languageService->sL($item[0])) . '</option>';
204
            }
205
            $valuePickerHtml[] = '</select>';
206
        }
207
208
        $fieldWizardResult = $this->renderFieldWizard();
209
        $fieldWizardHtml = $fieldWizardResult['html'];
210
        $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldWizardResult, false);
211
212
        $fieldControlResult = $this->renderFieldControl();
213
        $fieldControlHtml = $fieldControlResult['html'];
214
        $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldControlResult, false);
215
216
        $linkExplanation = $this->getLinkExplanation($itemValue ?: '');
217
        $explanation = htmlspecialchars($linkExplanation['text']);
218
        $toggleButtonTitle = $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:buttons.toggleLinkExplanation');
219
220
        $expansionHtml = [];
221
        $expansionHtml[] = '<div class="form-control-wrap" style="max-width: ' . $width . 'px">';
222
        $expansionHtml[] =  '<div class="form-wizards-wrap">';
223
        $expansionHtml[] =      '<div class="form-wizards-element">';
224
        $expansionHtml[] =          '<div class="input-group t3js-form-field-inputlink">';
225
        $expansionHtml[] =              '<span class="t3js-form-field-inputlink-icon input-group-addon">' . $linkExplanation['icon'] . '</span>';
226
        $expansionHtml[] =              '<input class="form-control t3js-form-field-inputlink-explanation" data-bs-toggle="tooltip" data-title="' . $explanation . '" value="' . $explanation . '" readonly>';
227
        $expansionHtml[] =              '<input type="text" ' . GeneralUtility::implodeAttributes($attributes, true) . ' />';
228
        $expansionHtml[] =              '<span class="input-group-btn">';
229
        $expansionHtml[] =                  '<button class="btn btn-default t3js-form-field-inputlink-explanation-toggle" type="button" title="' . htmlspecialchars($toggleButtonTitle) . '">';
230
        $expansionHtml[] =                      $this->iconFactory->getIcon('actions-version-workspaces-preview-link', Icon::SIZE_SMALL)->render();
231
        $expansionHtml[] =                  '</button>';
232
        $expansionHtml[] =              '</span>';
233
        $expansionHtml[] =              '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($itemValue) . '" />';
234
        $expansionHtml[] =          '</div>';
235
        $expansionHtml[] =      '</div>';
236
        if (!empty($valuePickerHtml) || !empty($fieldControlHtml)) {
237
            $expansionHtml[] =      '<div class="form-wizards-items-aside">';
238
            $expansionHtml[] =          '<div class="btn-group">';
239
            $expansionHtml[] =              implode(LF, $valuePickerHtml);
240
            $expansionHtml[] =              $fieldControlHtml;
241
            $expansionHtml[] =          '</div>';
242
            $expansionHtml[] =      '</div>';
243
        }
244
        $expansionHtml[] =      '<div class="form-wizards-items-bottom">';
245
        $expansionHtml[] =          $linkExplanation['additionalAttributes'];
246
        $expansionHtml[] =          $fieldWizardHtml;
247
        $expansionHtml[] =      '</div>';
248
        $expansionHtml[] =  '</div>';
249
        $expansionHtml[] = '</div>';
250
        $expansionHtml = implode(LF, $expansionHtml);
251
252
        $fullElement = $expansionHtml;
253
        if ($this->hasNullCheckboxButNoPlaceholder()) {
254
            $checked = $itemValue !== null ? ' checked="checked"' : '';
255
            $fullElement = [];
256
            $fullElement[] = '<div class="t3-form-field-disable"></div>';
257
            $fullElement[] = '<div class="form-check t3-form-field-eval-null-checkbox">';
258
            $fullElement[] =     '<input type="hidden" name="' . $nullControlNameEscaped . '" value="0" />';
259
            $fullElement[] =     '<input type="checkbox" class="form-check-input" name="' . $nullControlNameEscaped . '" id="' . $nullControlNameEscaped . '" value="1"' . $checked . ' />';
260
            $fullElement[] =     '<label class="form-check-label" for="' . $nullControlNameEscaped . '">';
261
            $fullElement[] =         $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.nullCheckbox');
262
            $fullElement[] =     '</label>';
263
            $fullElement[] = '</div>';
264
            $fullElement[] = $expansionHtml;
265
            $fullElement = implode(LF, $fullElement);
266
        } elseif ($this->hasNullCheckboxWithPlaceholder()) {
267
            $checked = $itemValue !== null ? ' checked="checked"' : '';
268
            $placeholder = $shortenedPlaceholder = $config['placeholder'] ?? '';
269
            $disabled = '';
270
            $fallbackValue = 0;
271
            if (strlen($placeholder) > 0) {
272
                $shortenedPlaceholder = GeneralUtility::fixed_lgd_cs($placeholder, 20);
273
                if ($placeholder !== $shortenedPlaceholder) {
274
                    $overrideLabel = sprintf(
275
                        $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override'),
276
                        '<span title="' . htmlspecialchars($placeholder) . '">' . htmlspecialchars($shortenedPlaceholder) . '</span>'
277
                    );
278
                } else {
279
                    $overrideLabel = sprintf(
280
                        $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override'),
281
                        htmlspecialchars($placeholder)
282
                    );
283
                }
284
            } else {
285
                $overrideLabel = $languageService->sL(
286
                    'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override_not_available'
287
                );
288
            }
289
            $fullElement = [];
290
            $fullElement[] = '<div class="form-check t3js-form-field-eval-null-placeholder-checkbox">';
291
            $fullElement[] =     '<input type="hidden" name="' . $nullControlNameEscaped . '" value="' . $fallbackValue . '" />';
292
            $fullElement[] =     '<input type="checkbox" class="form-check-input" name="' . $nullControlNameEscaped . '" id="' . $nullControlNameEscaped . '" value="1"' . $checked . $disabled . ' />';
293
            $fullElement[] =     '<label class="form-check-label" for="' . $nullControlNameEscaped . '">';
294
            $fullElement[] =         $overrideLabel;
295
            $fullElement[] =     '</label>';
296
            $fullElement[] = '</div>';
297
            $fullElement[] = '<div class="t3js-formengine-placeholder-placeholder">';
298
            $fullElement[] =    '<div class="form-control-wrap" style="max-width:' . $width . 'px">';
299
            $fullElement[] =        '<input type="text" class="form-control" disabled="disabled" value="' . htmlspecialchars($shortenedPlaceholder) . '" />';
300
            $fullElement[] =    '</div>';
301
            $fullElement[] = '</div>';
302
            $fullElement[] = '<div class="t3js-formengine-placeholder-formfield">';
303
            $fullElement[] =    $expansionHtml;
304
            $fullElement[] = '</div>';
305
            $fullElement = implode(LF, $fullElement);
306
        }
307
308
        $resultArray['requireJsModules'][] = ['TYPO3/CMS/Backend/FormEngine/Element/InputLinkElement' => '
309
            function(InputLinkElement) {
310
                new InputLinkElement(' . GeneralUtility::quoteJSvalue($fieldId) . ');
311
            }'
312
        ];
313
        $resultArray['html'] = '<div class="formengine-field-item t3js-formengine-field-item">' . $fieldInformationHtml . $fullElement . '</div>';
314
        return $resultArray;
315
    }
316
317
    /**
318
     * @param string $itemValue
319
     * @return array
320
     */
321
    protected function getLinkExplanation(string $itemValue): array
322
    {
323
        if (empty($itemValue)) {
324
            return [];
325
        }
326
        $data = ['text' => '', 'icon' => ''];
327
        $typolinkService = GeneralUtility::makeInstance(TypoLinkCodecService::class);
328
        $linkParts = $typolinkService->decode($itemValue);
329
        $linkService = GeneralUtility::makeInstance(LinkService::class);
330
331
        try {
332
            $linkData = $linkService->resolve($linkParts['url']);
333
        } catch (FileDoesNotExistException|FolderDoesNotExistException|UnknownLinkHandlerException|InvalidPathException $e) {
334
            return $data;
335
        }
336
337
        // Resolving the TypoLink parts (class, title, params)
338
        $additionalAttributes = [];
339
        foreach ($linkParts as $key => $value) {
340
            if ($key === 'url') {
341
                continue;
342
            }
343
            if ($value) {
344
                switch ($key) {
345
                    case 'class':
346
                        $label = $this->getLanguageService()->sL('LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:class');
347
                        break;
348
                    case 'title':
349
                        $label = $this->getLanguageService()->sL('LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:title');
350
                        break;
351
                    case 'additionalParams':
352
                        $label = $this->getLanguageService()->sL('LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:params');
353
                        break;
354
                    default:
355
                        $label = (string)$key;
356
                }
357
358
                $additionalAttributes[] = '<span><strong>' . htmlspecialchars($label) . ': </strong> ' . htmlspecialchars($value) . '</span>';
359
            }
360
        }
361
362
        // Resolve the actual link
363
        switch ($linkData['type']) {
364
            case LinkService::TYPE_PAGE:
365
                $pageRecord = BackendUtility::readPageAccess($linkData['pageuid'], '1=1');
366
                // Is this a real page
367
                if ($pageRecord['uid']) {
368
                    $fragmentTitle = '';
369
                    if (isset($linkData['fragment'])) {
370
                        if (MathUtility::canBeInterpretedAsInteger($linkData['fragment'])) {
371
                            $contentElement = BackendUtility::getRecord('tt_content', (int)$linkData['fragment'], '*', 'pid=' . $pageRecord['uid']);
372
                            if ($contentElement) {
373
                                $fragmentTitle = BackendUtility::getRecordTitle('tt_content', $contentElement, false, false);
374
                            }
375
                        }
376
                        $fragmentTitle = ' #' . ($fragmentTitle ?: $linkData['fragment']);
377
                    }
378
                    $data = [
379
                        'text' => $pageRecord['_thePathFull'] . '[' . $pageRecord['uid'] . ']' . $fragmentTitle,
380
                        'icon' => $this->iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render()
0 ignored issues
show
Bug introduced by
It seems like $pageRecord can also be of type false; however, parameter $row of TYPO3\CMS\Core\Imaging\I...ory::getIconForRecord() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

380
                        'icon' => $this->iconFactory->getIconForRecord('pages', /** @scrutinizer ignore-type */ $pageRecord, Icon::SIZE_SMALL)->render()
Loading history...
381
                    ];
382
                }
383
                break;
384
            case LinkService::TYPE_EMAIL:
385
                $data = [
386
                    'text' => $linkData['email'],
387
                    'icon' => $this->iconFactory->getIcon('content-elements-mailform', Icon::SIZE_SMALL)->render()
388
                ];
389
                break;
390
            case LinkService::TYPE_URL:
391
                $data = [
392
                    'text' => $linkData['url'],
393
                    'icon' => $this->iconFactory->getIcon('apps-pagetree-page-shortcut-external', Icon::SIZE_SMALL)->render()
394
395
                ];
396
                break;
397
            case LinkService::TYPE_FILE:
398
                /** @var File $file */
399
                $file = $linkData['file'];
400
                if ($file) {
0 ignored issues
show
introduced by
$file is of type TYPO3\CMS\Core\Resource\File, thus it always evaluated to true.
Loading history...
401
                    $data = [
402
                        'text' => $file->getPublicUrl(),
403
                        'icon' => $this->iconFactory->getIconForFileExtension($file->getExtension(), Icon::SIZE_SMALL)->render()
404
                    ];
405
                }
406
                break;
407
            case LinkService::TYPE_FOLDER:
408
                /** @var Folder $folder */
409
                $folder = $linkData['folder'];
410
                if ($folder) {
0 ignored issues
show
introduced by
$folder is of type TYPO3\CMS\Core\Resource\Folder, thus it always evaluated to true.
Loading history...
411
                    $data = [
412
                        'text' => $folder->getPublicUrl(),
413
                        'icon' => $this->iconFactory->getIcon('apps-filetree-folder-default', Icon::SIZE_SMALL)->render()
414
                    ];
415
                }
416
                break;
417
            case LinkService::TYPE_RECORD:
418
                $table = $this->data['pageTsConfig']['TCEMAIN.']['linkHandler.'][$linkData['identifier'] . '.']['configuration.']['table'];
419
                $record = BackendUtility::getRecord($table, $linkData['uid']);
420
                if ($record) {
421
                    $recordTitle = BackendUtility::getRecordTitle($table, $record);
422
                    $tableTitle = $this->getLanguageService()->sL($GLOBALS['TCA'][$table]['ctrl']['title']);
423
                    $data = [
424
                        'text' => sprintf('%s [%s:%d]', $recordTitle, $tableTitle, $linkData['uid']),
425
                        'icon' => $this->iconFactory->getIconForRecord($table, $record, Icon::SIZE_SMALL)->render(),
426
                    ];
427
                } else {
428
                    $data = [
429
                        'text' => sprintf('%s', $linkData['uid']),
430
                        'icon' => $this->iconFactory->getIcon('tcarecords-' . $table . '-default', Icon::SIZE_SMALL, 'overlay-missing')->render(),
431
                    ];
432
                }
433
                break;
434
            case LinkService::TYPE_TELEPHONE:
435
                $telephone = $linkData['telephone'];
436
                if ($telephone) {
437
                    $data = [
438
                        'text' => $telephone,
439
                        'icon' => $this->iconFactory->getIcon('actions-device-mobile', Icon::SIZE_SMALL)->render()
440
                    ];
441
                }
442
                break;
443
            default:
444
                // Please note that this hook is preliminary and might change, as this element could become its own
445
                // TCA type in the future
446
                if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['linkHandler'][$linkData['type']])) {
447
                    $linkBuilder = GeneralUtility::makeInstance($GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['linkHandler'][$linkData['type']]);
448
                    $data = $linkBuilder->getFormData($linkData, $linkParts, $this->data, $this);
449
                } else {
450
                    $data = [
451
                        'text' => 'not implemented type ' . $linkData['type'],
452
                        'icon' => ''
453
                    ];
454
                }
455
        }
456
457
        $data['additionalAttributes'] = '<div class="help-block">' . implode(' - ', $additionalAttributes) . '</div>';
458
        return $data;
459
    }
460
461
    /**
462
     * @return LanguageService
463
     */
464
    protected function getLanguageService()
465
    {
466
        return $GLOBALS['LANG'];
467
    }
468
}
469