[ 'renderType' => 'tcaDescription', ], ]; /** * Default field wizards enabled for this element. * * @var array */ protected $defaultFieldWizard = [ 'localizationStateSelector' => [ 'renderType' => 'localizationStateSelector', ], 'otherLanguageContent' => [ 'renderType' => 'otherLanguageContent', 'after' => [ 'localizationStateSelector' ], ], 'defaultLanguageDifferences' => [ 'renderType' => 'defaultLanguageDifferences', 'after' => [ 'otherLanguageContent', ], ], ]; /** * The number of chars expected per row when the height of a text area field is * automatically calculated based on the number of characters found in the field content. * * @var int */ protected $charactersPerRow = 40; /** * This will render a '; $html[] = ''; $html[] = ''; $html[] = ''; $html[] = ''; $resultArray['html'] = implode(LF, $html); return $resultArray; } // @todo: The whole eval handling is a mess and needs refactoring foreach ($evalList as $func) { // @todo: This is ugly: The code should find out on it's own whether an eval definition is a // @todo: keyword like "date", or a class reference. The global registration could be dropped then // Pair hook to the one in \TYPO3\CMS\Core\DataHandling\DataHandler::checkValue_input_Eval() // There is a similar hook for "evaluateFieldValue" in DataHandler and InputTextElement if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][$func])) { if (class_exists($func)) { $evalObj = GeneralUtility::makeInstance($func); if (method_exists($evalObj, 'deevaluateFieldValue')) { $_params = [ 'value' => $itemValue ]; $itemValue = $evalObj->deevaluateFieldValue($_params); } } } } $fieldId = StringUtility::getUniqueId('formengine-textarea-'); $attributes = [ 'id' => $fieldId, 'name' => htmlspecialchars($parameterArray['itemFormElName']), 'data-formengine-validation-rules' => $this->getValidationDataAsJsonString($config), 'data-formengine-input-name' => htmlspecialchars($parameterArray['itemFormElName']), 'rows' => (string)$rows, 'wrap' => (string)($config['wrap'] ?: 'virtual'), 'onChange' => implode('', $parameterArray['fieldChangeFunc']), ]; $classes = [ 'form-control', 't3js-formengine-textarea', 'formengine-textarea', ]; if ($config['fixedFont']) { $classes[] = 'text-monospace'; } if ($config['enableTabulator']) { $classes[] = 't3js-enable-tab'; } $attributes['class'] = implode(' ', $classes); $maximumHeight = (int)$backendUser->uc['resizeTextareas_MaxHeight']; if ($maximumHeight > 0) { // add the max-height from the users' preference to it $attributes['style'] = 'max-height: ' . $maximumHeight . 'px'; } if (isset($config['max']) && (int)$config['max'] > 0) { $attributes['maxlength'] = (string)(int)$config['max']; } if (!empty($config['placeholder'])) { $attributes['placeholder'] = htmlspecialchars(trim($config['placeholder'])); } $valuePickerHtml = []; if (isset($config['valuePicker']['items']) && is_array($config['valuePicker']['items'])) { $mode = $config['valuePicker']['mode'] ?? ''; $itemName = $parameterArray['itemFormElName']; $fieldChangeFunc = $parameterArray['fieldChangeFunc']; if ($mode === 'append') { $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]' . '.value=\'\'+this.options[this.selectedIndex].value+document.editform[' . GeneralUtility::quoteJSvalue($itemName) . '].value'; } elseif ($mode === 'prepend') { $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]' . '.value+=\'\'+this.options[this.selectedIndex].value'; } else { $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]' . '.value=this.options[this.selectedIndex].value'; } $valuePickerHtml[] = '' . htmlspecialchars($languageService->sL($item[0])) . ''; } $valuePickerHtml[] = ''; } $fieldControlResult = $this->renderFieldControl(); $fieldControlHtml = $fieldControlResult['html']; $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldControlResult, false); $fieldWizardResult = $this->renderFieldWizard(); $fieldWizardHtml = $fieldWizardResult['html']; $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldWizardResult, false); $mainFieldHtml = []; $mainFieldHtml[] = '
'; $mainFieldHtml[] = '
'; $mainFieldHtml[] = '
'; $mainFieldHtml[] = ''; $mainFieldHtml[] = '
'; if (!empty($valuePickerHtml) || !empty($fieldControlHtml)) { $mainFieldHtml[] = '
'; $mainFieldHtml[] = '
'; $mainFieldHtml[] = implode(LF, $valuePickerHtml); $mainFieldHtml[] = $fieldControlHtml; $mainFieldHtml[] = '
'; $mainFieldHtml[] = '
'; } if (!empty($fieldWizardHtml)) { $mainFieldHtml[] = '
'; $mainFieldHtml[] = $fieldWizardHtml; $mainFieldHtml[] = '
'; } $mainFieldHtml[] = '
'; $mainFieldHtml[] = '
'; $mainFieldHtml = implode(LF, $mainFieldHtml); $fullElement = $mainFieldHtml; if ($this->hasNullCheckboxButNoPlaceholder()) { $checked = $itemValue !== null ? ' checked="checked"' : ''; $fullElement = []; $fullElement[] = '
'; $fullElement[] = '
'; $fullElement[] = ''; $fullElement[] = '
'; $fullElement[] = $mainFieldHtml; $fullElement = implode(LF, $fullElement); } elseif ($this->hasNullCheckboxWithPlaceholder()) { $checked = $itemValue !== null ? ' checked="checked"' : ''; $placeholder = $shortenedPlaceholder = $config['placeholder'] ?? ''; $disabled = ''; $fallbackValue = 0; if (strlen($placeholder) > 0) { $shortenedPlaceholder = GeneralUtility::fixed_lgd_cs($placeholder, 20); if ($placeholder !== $shortenedPlaceholder) { $overrideLabel = sprintf( $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override'), '' . htmlspecialchars($shortenedPlaceholder) . '' ); } else { $overrideLabel = sprintf( $languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override'), htmlspecialchars($placeholder) ); } } else { $overrideLabel = $languageService->sL( 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.placeholder.override_not_available' ); } $fullElement = []; $fullElement[] = '
'; $fullElement[] = ''; $fullElement[] = '
'; $fullElement[] = '
'; $fullElement[] = '
'; $fullElement[] = ' ' function(TextElement) { new TextElement(' . GeneralUtility::quoteJSvalue($fieldId) . '); }' ]; $resultArray['html'] = '
' . $fieldInformationHtml . $fullElement . '
'; return $resultArray; } /** * @return BackendUserAuthentication */ protected function getBackendUserAuthentication() { return $GLOBALS['BE_USER']; } /** * @return LanguageService */ protected function getLanguageService() { return $GLOBALS['LANG']; } }