TYPO3  7.6
DeleteFileViewHelper.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Filelist\ViewHelpers\Uri;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
17 use Closure;
22 
27 {
36  public function render(\TYPO3\CMS\Core\Resource\AbstractFile $file, $returnUrl = '')
37  {
38  return static::renderStatic(
39  [
40  'file' => $file,
41  'returnUrl' => $returnUrl,
42  ],
44  $this->renderingContext
45  );
46  }
47 
58  {
59  $veriCode = '&vC=';
60  if ($GLOBALS['BE_USER'] instanceof \TYPO3\CMS\Core\Authentication\BackendUserAuthentication) {
61  $veriCode .= $GLOBALS['BE_USER']->veriCode() . BackendUtility::getUrlToken('tceAction');
62  }
63 
64  if (empty($arguments['returnUrl'])) {
65  $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
66  }
67 
69  $file = $arguments['file'];
70 
71  $params = [
72  'file' => [
73  'delete' => [
74  0 => [
75  'data' => $file->getCombinedIdentifier()
76  ]
77  ]
78  ],
79  'redirect' => $arguments['returnUrl']
80  ];
81 
82  return BackendUtility::getModuleUrl('tce_file', $params) . $veriCode;
83  }
84 }