20 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
21 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
22 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
29 use CompileWithRenderStatic;
36 $this->registerArgument(
'file', \
TYPO3\CMS\Core\Resource\AbstractFile::class,
'',
true);
37 $this->registerArgument(
'copyOrCut',
'string',
'',
false,
'copy');
50 public static function renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
52 if ($arguments[
'copyOrCut'] !==
'cut' && $arguments[
'copyOrCut'] !==
'copy') {
53 throw new \InvalidArgumentException(
'Argument "copyOrCut" must be either "copy" or "cut"', 1540548015);
57 $file = $arguments[
'file'];
60 $clipboard = GeneralUtility::makeInstance(Clipboard::class);
61 $clipboard->initializeClipboard();
63 $fullIdentifier = $file->getCombinedIdentifier();
64 $md5 = GeneralUtility::shortMD5($fullIdentifier);
65 $isSel = $clipboard->isSelected(
'_FILE', $md5);
67 if ($arguments[
'copyOrCut'] ===
'copy') {
68 return $clipboard->selUrlFile($fullIdentifier,
true, $isSel ===
'copy');
70 return $clipboard->selUrlFile($fullIdentifier,
false, $isSel ===
'cut');