2 declare(strict_types = 1);
39 $parameterArray = $this->data[
'parameterArray'];
40 $elementName = $parameterArray[
'itemFormElName'];
41 $config = $parameterArray[
'fieldConf'][
'config'];
42 $internalType = (string)$config[
'internal_type'];
43 $clipboardElements = $config[
'clipboardElements'];
45 if ((isset($config[
'readOnly']) && $config[
'readOnly'])
46 || empty($clipboardElements)
53 'element' => $elementName,
54 'clipboardItems' => [],
56 if ($internalType ===
'file_reference' || $internalType ===
'file') {
58 $title = sprintf($languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.clipInsert_file'), count($clipboardElements));
59 foreach ($clipboardElements as $clipboardElement) {
60 $dataAttributes[
'clipboardItems'][] = [
62 'value' => $clipboardElement[
'value'],
65 } elseif ($internalType ===
'db') {
66 $title = sprintf($languageService->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.clipInsert_db'), count($clipboardElements));
67 foreach ($clipboardElements as $clipboardElement) {
68 $dataAttributes[
'clipboardItems'][] = [
69 'title' => $clipboardElement[
'title'],
70 'value' => $clipboardElement[
'value'],
78 'iconIdentifier' =>
'actions-document-paste-into',
81 'id' => htmlspecialchars($id),
82 'data-element' => $dataAttributes[
'element'],
83 'data-clipboard-items' => json_encode($dataAttributes[
'clipboardItems']),
85 'requireJsModules' => [
86 [
'TYPO3/CMS/Backend/FormEngine/FieldControl/InsertClipboard' =>
'function(FieldControl) {new FieldControl(' . GeneralUtility::quoteJSvalue(
'#' . $id) .
');}'],