/** * @param string $relativeTo * @param boolean $reference * @return string */ public static function createIconWithUrl($relativeTo, $reference = FALSE) { $data = self::getClipBoardData($reference); if (NULL === $data) { return ''; } $reference = (bool) $reference; $clipBoard = new \TYPO3\CMS\Backend\Clipboard\Clipboard(); if (TRUE === $reference) { $label = 'Paste as reference in this position'; $icon = 'actions-insert-reference'; } else { $label = 'Paste in this position'; $icon = 'actions-document-paste-after'; } $icon = MiscellaneousUtility::getIcon($icon, $label); $uri = "javascript:top.content.list_frame.location.href=top.TS.PATH_typo3+'"; $uri .= $clipBoard->pasteUrl('tt_content', $relativeTo); $uri .= "';"; return MiscellaneousUtility::wrapLink($icon, $uri); }
/** * @param integer $pid * @param integer $colPos * @param integer $relativeUid * @param bool $reference * @return string */ protected function getPasteIcon($pid, $colPos, $relativeUid = 0, $reference = FALSE) { $clipData = $GLOBALS['BE_USER']->getModuleData('clipboard', $GLOBALS['BE_USER']->getTSConfigVal('options.saveClipboard') ? '' : 'ses'); $mode = TRUE === isset($clipData['current']) ? $clipData['current'] : 'normal'; $hasClip = TRUE === isset($clipData[$mode]['el']) && 0 < count($clipData[$mode]['el']); if (FALSE === $hasClip) { return NULL; } if (FALSE === isset($clipData[$mode]['mode']) && TRUE === $reference) { return NULL; } $uid = 0; $clipBoard = new \TYPO3\CMS\Backend\Clipboard\Clipboard(); if (TRUE === $reference) { $command = 'reference'; $label = 'Paste as reference in this position'; $icon = 'actions-insert-reference'; } else { $command = 'paste'; $label = 'Paste in this position'; $icon = 'actions-document-paste-after'; } $relativeTo = $pid . '-' . $command . '-' . $relativeUid . '-' . $uid; $relativeTo .= '--' . $colPos; $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon($icon, array('title' => $label, 'class' => 't3-icon-actions t3-icon-document-new')); $uri = "javascript:top.content.list_frame.location.href=top.TS.PATH_typo3+'"; $uri .= $clipBoard->pasteUrl('tt_content', $relativeTo); $uri .= "';"; return $this->wrapLink($icon, $uri); }