46 'renderType' =>
'tcaDescription',
57 'renderType' =>
'linkPopup',
68 'localizationStateSelector' => [
69 'renderType' =>
'localizationStateSelector',
71 'otherLanguageContent' => [
72 'renderType' =>
'otherLanguageContent',
74 'localizationStateSelector'
77 'defaultLanguageDifferences' => [
78 'renderType' =>
'defaultLanguageDifferences',
80 'otherLanguageContent',
94 $table = $this->data[
'tableName'];
95 $fieldName = $this->data[
'fieldName'];
96 $row = $this->data[
'databaseRow'];
97 $parameterArray = $this->data[
'parameterArray'];
99 $config = $parameterArray[
'fieldConf'][
'config'];
101 $itemValue = $parameterArray[
'itemFormElValue'];
102 $evalList = GeneralUtility::trimExplode(
',', $config[
'eval'],
true);
105 $nullControlNameEscaped = htmlspecialchars(
'control[active][' . $table .
'][' . $row[
'uid'] .
'][' . $fieldName .
']');
108 $fieldInformationHtml = $fieldInformationResult[
'html'];
111 if ($config[
'readOnly']) {
114 $html[] =
'<div class="formengine-field-item t3js-formengine-field-item">';
115 $html[] = $fieldInformationHtml;
116 $html[] =
'<div class="form-wizards-wrap">';
117 $html[] =
'<div class="form-wizards-element">';
118 $html[] =
'<div class="form-control-wrap" style="max-width: ' . $width .
'px">';
119 $html[] =
'<input class="form-control" value="' . htmlspecialchars($itemValue) .
'" type="text" disabled>';
124 $resultArray[
'html'] = implode(LF, $html);
129 foreach ($evalList as $func) {
133 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tce'][
'formevals'][$func])) {
134 if (class_exists($func)) {
135 $evalObj = GeneralUtility::makeInstance($func);
136 if (method_exists($evalObj,
'deevaluateFieldValue')) {
138 'value' => $itemValue
140 $itemValue = $evalObj->deevaluateFieldValue($_params);
142 if (method_exists($evalObj,
'returnFieldJS')) {
143 $resultArray[
'additionalJavaScriptPost'][] =
'TBE_EDITOR.customEvalFunctions[' . GeneralUtility::quoteJSvalue($func) .
']'
144 .
' = function(value) {' . $evalObj->returnFieldJS() .
'};';
153 'class' => implode(
' ', [
156 't3js-form-field-inputlink-input',
161 'data-formengine-input-params' => json_encode([
162 'field' => $parameterArray[
'itemFormElName'],
163 'evalList' => implode(
',', $evalList)
165 'data-formengine-input-name' => $parameterArray[
'itemFormElName'],
168 $maxLength = $config[
'max'] ?? 0;
169 if ((
int)$maxLength > 0) {
170 $attributes[
'maxlength'] = (int)$maxLength;
172 if (!empty($config[
'placeholder'])) {
173 $attributes[
'placeholder'] = trim($config[
'placeholder']);
175 if (isset($config[
'autocomplete'])) {
176 $attributes[
'autocomplete'] = empty($config[
'autocomplete']) ?
'new-' . $fieldName :
'on';
179 $valuePickerHtml = [];
180 if (isset($config[
'valuePicker'][
'items']) && is_array($config[
'valuePicker'][
'items'])) {
181 $mode = $config[
'valuePicker'][
'mode'] ??
'';
182 $itemName = $parameterArray[
'itemFormElName'];
183 $fieldChangeFunc = $parameterArray[
'fieldChangeFunc'];
184 if ($mode ===
'append') {
185 $assignValue =
'document.querySelectorAll(' . GeneralUtility::quoteJSvalue(
'[data-formengine-input-name="' . $itemName .
'"]') .
')[0]'
186 .
'.value=\'\'+this.options[this.selectedIndex].value+document.editform[' . GeneralUtility::quoteJSvalue($itemName) .
'].value';
187 } elseif ($mode ===
'prepend') {
188 $assignValue =
'document.querySelectorAll(' . GeneralUtility::quoteJSvalue(
'[data-formengine-input-name="' . $itemName .
'"]') .
')[0]'
189 .
'.value+=\'\'+this.options[this.selectedIndex].value';
191 $assignValue =
'document.querySelectorAll(' . GeneralUtility::quoteJSvalue(
'[data-formengine-input-name="' . $itemName .
'"]') .
')[0]'
192 .
'.value=this.options[this.selectedIndex].value';
194 $valuePickerHtml[] =
'<select';
195 $valuePickerHtml[] =
' class="form-control tceforms-select tceforms-wizardselect"';
196 $valuePickerHtml[] =
' onchange="' . htmlspecialchars($assignValue .
';this.blur();this.selectedIndex=0;' . implode(
'', $fieldChangeFunc)) .
'"';
197 $valuePickerHtml[] =
'>';
198 $valuePickerHtml[] =
'<option></option>';
199 foreach ($config[
'valuePicker'][
'items'] as $item) {
200 $valuePickerHtml[] =
'<option value="' . htmlspecialchars($item[1]) .
'">' . htmlspecialchars($languageService->sL($item[0])) .
'</option>';
202 $valuePickerHtml[] =
'</select>';
206 $fieldWizardHtml = $fieldWizardResult[
'html'];
210 $fieldControlHtml = $fieldControlResult[
'html'];
214 $explanation = htmlspecialchars($linkExplanation[
'text']);
215 $toggleButtonTitle = $languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:buttons.toggleLinkExplanation');
218 $expansionHtml[] =
'<div class="form-control-wrap" style="max-width: ' . $width .
'px">';
219 $expansionHtml[] =
'<div class="form-wizards-wrap">';
220 $expansionHtml[] =
'<div class="form-wizards-element">';
221 $expansionHtml[] =
'<div class="input-group t3js-form-field-inputlink">';
222 $expansionHtml[] =
'<span class="t3js-form-field-inputlink-icon input-group-addon">' . $linkExplanation[
'icon'] .
'</span>';
223 $expansionHtml[] =
'<input class="form-control form-field-inputlink-explanation t3js-form-field-inputlink-explanation" data-toggle="tooltip" data-title="' . $explanation .
'" value="' . $explanation .
'" readonly>';
224 $expansionHtml[] =
'<input type="text" ' . GeneralUtility::implodeAttributes($attributes,
true) .
' />';
225 $expansionHtml[] =
'<span class="input-group-btn">';
226 $expansionHtml[] =
'<button class="btn btn-default t3js-form-field-inputlink-explanation-toggle" type="button" title="' . htmlspecialchars($toggleButtonTitle) .
'">';
227 $expansionHtml[] = $this->iconFactory->getIcon(
'actions-version-workspaces-preview-link',
Icon::SIZE_SMALL)->render();
228 $expansionHtml[] =
'</button>';
229 $expansionHtml[] =
'</span>';
230 $expansionHtml[] =
'<input type="hidden" name="' . $parameterArray[
'itemFormElName'] .
'" value="' . htmlspecialchars($itemValue) .
'" />';
231 $expansionHtml[] =
'</div>';
232 $expansionHtml[] =
'</div>';
233 if (!empty($valuePickerHtml) || !empty($fieldControlHtml)) {
234 $expansionHtml[] =
'<div class="form-wizards-items-aside">';
235 $expansionHtml[] =
'<div class="btn-group">';
236 $expansionHtml[] = implode(LF, $valuePickerHtml);
237 $expansionHtml[] = $fieldControlHtml;
238 $expansionHtml[] =
'</div>';
239 $expansionHtml[] =
'</div>';
241 $expansionHtml[] =
'<div class="form-wizards-items-bottom">';
242 $expansionHtml[] = $linkExplanation[
'additionalAttributes'];
243 $expansionHtml[] = $fieldWizardHtml;
244 $expansionHtml[] =
'</div>';
245 $expansionHtml[] =
'</div>';
246 $expansionHtml[] =
'</div>';
247 $expansionHtml = implode(LF, $expansionHtml);
249 $fullElement = $expansionHtml;
251 $checked = $itemValue !==
null ?
' checked="checked"' :
'';
253 $fullElement[] =
'<div class="t3-form-field-disable"></div>';
254 $fullElement[] =
'<div class="checkbox t3-form-field-eval-null-checkbox">';
255 $fullElement[] =
'<label for="' . $nullControlNameEscaped .
'">';
256 $fullElement[] =
'<input type="hidden" name="' . $nullControlNameEscaped .
'" value="0" />';
257 $fullElement[] =
'<input type="checkbox" name="' . $nullControlNameEscaped .
'" id="' . $nullControlNameEscaped .
'" value="1"' . $checked .
' />';
258 $fullElement[] = $languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.nullCheckbox');
259 $fullElement[] =
'</label>';
260 $fullElement[] =
'</div>';
261 $fullElement[] = $expansionHtml;
262 $fullElement = implode(LF, $fullElement);
264 $checked = $itemValue !==
null ?
' checked="checked"' :
'';
265 $placeholder = $shortenedPlaceholder = $config[
'placeholder'] ??
'';
268 if (strlen($placeholder) > 0) {
269 $shortenedPlaceholder = GeneralUtility::fixed_lgd_cs($placeholder, 20);
270 if ($placeholder !== $shortenedPlaceholder) {
271 $overrideLabel = sprintf(
272 $languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override'),
273 '<span title="' . htmlspecialchars($placeholder) .
'">' . htmlspecialchars($shortenedPlaceholder) .
'</span>'
276 $overrideLabel = sprintf(
277 $languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override'),
278 htmlspecialchars($placeholder)
282 $overrideLabel = $languageService->sL(
283 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override_not_available'
287 $fullElement[] =
'<div class="checkbox t3js-form-field-eval-null-placeholder-checkbox">';
288 $fullElement[] =
'<label for="' . $nullControlNameEscaped .
'">';
289 $fullElement[] =
'<input type="hidden" name="' . $nullControlNameEscaped .
'" value="' . $fallbackValue .
'" />';
290 $fullElement[] =
'<input type="checkbox" name="' . $nullControlNameEscaped .
'" id="' . $nullControlNameEscaped .
'" value="1"' . $checked . $disabled .
' />';
291 $fullElement[] = $overrideLabel;
292 $fullElement[] =
'</label>';
293 $fullElement[] =
'</div>';
294 $fullElement[] =
'<div class="t3js-formengine-placeholder-placeholder">';
295 $fullElement[] =
'<div class="form-control-wrap" style="max-width:' . $width .
'px">';
296 $fullElement[] =
'<input type="text" class="form-control" disabled="disabled" value="' . htmlspecialchars($shortenedPlaceholder) .
'" />';
297 $fullElement[] =
'</div>';
298 $fullElement[] =
'</div>';
299 $fullElement[] =
'<div class="t3js-formengine-placeholder-formfield">';
300 $fullElement[] = $expansionHtml;
301 $fullElement[] =
'</div>';
302 $fullElement = implode(LF, $fullElement);
305 $resultArray[
'html'] =
'<div class="formengine-field-item t3js-formengine-field-item">' . $fieldInformationHtml . $fullElement .
'</div>';
315 if (empty($itemValue)) {
318 $data = [
'text' =>
'',
'icon' =>
''];
319 $typolinkService = GeneralUtility::makeInstance(TypoLinkCodecService::class);
320 $linkParts = $typolinkService->decode($itemValue);
321 $linkService = GeneralUtility::makeInstance(LinkService::class);
324 $linkData = $linkService->resolve($linkParts[
'url']);
336 $additionalAttributes = [];
337 foreach ($linkParts as $key => $value) {
338 if ($key ===
'url') {
344 $label = $this->
getLanguageService()->
sL(
'LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:class');
347 $label = $this->
getLanguageService()->
sL(
'LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:title');
349 case 'additionalParams':
350 $label = $this->
getLanguageService()->
sL(
'LLL:EXT:recordlist/Resources/Private/Language/locallang_browse_links.xlf:params');
356 $additionalAttributes[] =
'<span><strong>' . htmlspecialchars($label) .
': </strong> ' . htmlspecialchars($value) .
'</span>';
361 switch ($linkData[
'type']) {
365 if ($pageRecord[
'uid']) {
367 'text' => $pageRecord[
'_thePathFull'] .
'[' . $pageRecord[
'uid'] .
']',
368 'icon' => $this->iconFactory->getIconForRecord(
'pages', $pageRecord,
Icon::SIZE_SMALL)->render()
374 'text' => $linkData[
'email'],
375 'icon' => $this->iconFactory->getIcon(
'content-elements-mailform',
Icon::SIZE_SMALL)->render()
381 'icon' => $this->iconFactory->getIcon(
'apps-pagetree-page-shortcut-external',
Icon::SIZE_SMALL)->render()
387 $file = $linkData[
'file'];
390 'text' => $file->getPublicUrl(),
391 'icon' => $this->iconFactory->getIconForFileExtension($file->getExtension(),
Icon::SIZE_SMALL)->render()
397 $folder = $linkData[
'folder'];
400 'text' => $folder->getPublicUrl(),
401 'icon' => $this->iconFactory->getIcon(
'apps-filetree-folder-default',
Icon::SIZE_SMALL)->render()
406 $table = $this->data[
'pageTsConfig'][
'TCEMAIN.'][
'linkHandler.'][$linkData[
'identifier'] .
'.'][
'configuration.'][
'table'];
412 'text' => sprintf(
'%s [%s:%d]', $recordTitle, $tableTitle, $linkData[
'uid']),
413 'icon' => $this->iconFactory->getIconForRecord($table, $record,
Icon::SIZE_SMALL)->render(),
417 'text' => sprintf(
'%s', $linkData[
'uid']),
418 'icon' => $this->iconFactory->getIcon(
'tcarecords-' . $table .
'-default',
Icon::SIZE_SMALL,
'overlay-missing')->render(),
425 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'formEngine'][
'linkHandler'][$linkData[
'type']])) {
426 $linkBuilder = GeneralUtility::makeInstance(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'formEngine'][
'linkHandler'][$linkData[
'type']]);
427 $data = $linkBuilder->getFormData($linkData, $linkParts, $this->data, $this);
430 'text' =>
'not implemented type ' . $linkData[
'type'],
436 $data[
'additionalAttributes'] =
'<div class="help-block">' . implode(
' - ', $additionalAttributes) .
'</div>';
447 $data = parse_url($uriString);
448 return $data[
'host'] ??
'';