[BUGFIX] Filelist: Only show paste buttons if clipObj is set
[Packages/TYPO3.CMS.git] / typo3 / sysext / filelist / Classes / FileList.php
index 045b71e..7e75e4d 100644 (file)
@@ -238,11 +238,14 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        if ($this->clickMenus) {
                                $otherMarkers['PAGE_ICON'] = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($otherMarkers['PAGE_ICON'], $folderObject->getCombinedIdentifier());
                        }
-                       // Add paste button
-                       $elFromTable = $this->clipObj->elFromTable('_FILE');
-                       if (count($elFromTable)) {
-                               $buttons['PASTE'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier())) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
+                       // Add paste button if clipboard is initialized
+                       if ($this->clipObj instanceof \TYPO3\CMS\Backend\Clipboard\Clipboard) {
+                               $elFromTable = $this->clipObj->elFromTable('_FILE');
+                               if (count($elFromTable)) {
+                                       $buttons['PASTE'] = '<a href="' . htmlspecialchars($this->clipObj->pasteUrl('_FILE', $this->folderObject->getCombinedIdentifier())) . '" onclick="return ' . htmlspecialchars($this->clipObj->confirmMsg('_FILE', $this->path, 'into', $elFromTable)) . '" title="' . $GLOBALS['LANG']->getLL('clip_paste', TRUE) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-paste-after') . '</a>';
+                               }
                        }
+
                }
                $buttons['refresh'] = '<a href="' . htmlspecialchars($this->listURL()) . '" title="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', 1) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-system-refresh') . '</a>';
                return array($buttons, $otherMarkers);