Code Duplication    Length = 24-24 lines in 3 locations

typo3/sysext/backend/Classes/Form/Element/InputTextElement.php 1 location

@@ 145-168 (lines=24) @@
142
        }
143
144
        $valuePickerHtml = [];
145
        if (isset($config['valuePicker']['items']) && is_array($config['valuePicker']['items'])) {
146
            $mode = $config['valuePicker']['mode'] ?? '';
147
            $itemName = $parameterArray['itemFormElName'];
148
            $fieldChangeFunc = $parameterArray['fieldChangeFunc'];
149
            if ($mode === 'append') {
150
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
151
                    . '.value+=\'\'+this.options[this.selectedIndex].value';
152
            } elseif ($mode === 'prepend') {
153
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
154
                    . '.value=\'\'+this.options[this.selectedIndex].value+document.editform[' . GeneralUtility::quoteJSvalue($itemName) . '].value';
155
            } else {
156
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
157
                    . '.value=this.options[this.selectedIndex].value';
158
            }
159
            $valuePickerHtml[] = '<select';
160
            $valuePickerHtml[] =  ' class="form-control tceforms-select tceforms-wizardselect"';
161
            $valuePickerHtml[] =  ' onchange="' . htmlspecialchars($assignValue . ';this.blur();this.selectedIndex=0;' . implode('', $fieldChangeFunc)) . '"';
162
            $valuePickerHtml[] = '>';
163
            $valuePickerHtml[] = '<option></option>';
164
            foreach ($config['valuePicker']['items'] as $item) {
165
                $valuePickerHtml[] = '<option value="' . htmlspecialchars($item[1]) . '">' . htmlspecialchars($languageService->sL($item[0])) . '</option>';
166
            }
167
            $valuePickerHtml[] = '</select>';
168
        }
169
170
        $valueSliderHtml = [];
171
        if (isset($config['slider']) && is_array($config['slider'])) {

typo3/sysext/backend/Classes/Form/Element/TextElement.php 1 location

@@ 167-190 (lines=24) @@
164
        }
165
166
        $valuePickerHtml = [];
167
        if (isset($config['valuePicker']['items']) && is_array($config['valuePicker']['items'])) {
168
            $mode = $config['valuePicker']['mode'] ?? '';
169
            $itemName = $parameterArray['itemFormElName'];
170
            $fieldChangeFunc = $parameterArray['fieldChangeFunc'];
171
            if ($mode === 'append') {
172
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
173
                    . '.value=\'\'+this.options[this.selectedIndex].value+document.editform[' . GeneralUtility::quoteJSvalue($itemName) . '].value';
174
            } elseif ($mode === 'prepend') {
175
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
176
                    . '.value+=\'\'+this.options[this.selectedIndex].value';
177
            } else {
178
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
179
                    . '.value=this.options[this.selectedIndex].value';
180
            }
181
            $valuePickerHtml[] = '<select';
182
            $valuePickerHtml[] =  ' class="form-control tceforms-select tceforms-wizardselect"';
183
            $valuePickerHtml[] =  ' onchange="' . htmlspecialchars($assignValue . ';this.blur();this.selectedIndex=0;' . implode('', $fieldChangeFunc)) . '"';
184
            $valuePickerHtml[] = '>';
185
            $valuePickerHtml[] = '<option></option>';
186
            foreach ($config['valuePicker']['items'] as $item) {
187
                $valuePickerHtml[] = '<option value="' . htmlspecialchars($item[1]) . '">' . htmlspecialchars($languageService->sL($item[0])) . '</option>';
188
            }
189
            $valuePickerHtml[] = '</select>';
190
        }
191
192
        $fieldInformationResult = $this->renderFieldInformation();
193
        $fieldInformationHtml = $fieldInformationResult['html'];

typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php 1 location

@@ 163-186 (lines=24) @@
160
        }
161
162
        $valuePickerHtml = [];
163
        if (isset($config['valuePicker']['items']) && is_array($config['valuePicker']['items'])) {
164
            $mode = $config['valuePicker']['mode'] ?? '';
165
            $itemName = $parameterArray['itemFormElName'];
166
            $fieldChangeFunc = $parameterArray['fieldChangeFunc'];
167
            if ($mode === 'append') {
168
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
169
                    . '.value=\'\'+this.options[this.selectedIndex].value+document.editform[' . GeneralUtility::quoteJSvalue($itemName) . '].value';
170
            } elseif ($mode === 'prepend') {
171
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
172
                    . '.value+=\'\'+this.options[this.selectedIndex].value';
173
            } else {
174
                $assignValue = 'document.querySelectorAll(' . GeneralUtility::quoteJSvalue('[data-formengine-input-name="' . $itemName . '"]') . ')[0]'
175
                    . '.value=this.options[this.selectedIndex].value';
176
            }
177
            $valuePickerHtml[] = '<select';
178
            $valuePickerHtml[] =  ' class="form-control tceforms-select tceforms-wizardselect"';
179
            $valuePickerHtml[] =  ' onchange="' . htmlspecialchars($assignValue . ';this.blur();this.selectedIndex=0;' . implode('', $fieldChangeFunc)) . '"';
180
            $valuePickerHtml[] = '>';
181
            $valuePickerHtml[] = '<option></option>';
182
            foreach ($config['valuePicker']['items'] as $item) {
183
                $valuePickerHtml[] = '<option value="' . htmlspecialchars($item[1]) . '">' . htmlspecialchars($languageService->sL($item[0])) . '</option>';
184
            }
185
            $valuePickerHtml[] = '</select>';
186
        }
187
188
        $fieldInformationResult = $this->renderFieldInformation();
189
        $fieldInformationHtml = $fieldInformationResult['html'];