‪TYPO3CMS  10.4
EditFileContentViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
18 use Closure;
22 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
23 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
24 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
25 
29 class ‪EditFileContentViewHelper extends AbstractViewHelper
30 {
31  use CompileWithRenderStatic;
32 
36  public function ‪initializeArguments()
37  {
38  $this->registerArgument('file', AbstractFile::class, '', true);
39  $this->registerArgument('returnUrl', 'string', '', false, '');
40  }
41 
51  public static function ‪renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
52  {
53  if (empty($arguments['returnUrl'])) {
54  $arguments['returnUrl'] = GeneralUtility::getIndpEnv('REQUEST_URI');
55  }
56 
58  $file = $arguments['file'];
59 
60  $params = [
61  'target' => $file->getCombinedIdentifier(),
62  'returnUrl' => $arguments['returnUrl']
63  ];
64  $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
65  return (string)$uriBuilder->buildUriFromRoute('file_edit', $params);
66  }
67 }
‪TYPO3\CMS\Filelist\ViewHelpers\Uri\EditFileContentViewHelper
Definition: EditFileContentViewHelper.php:30
‪TYPO3\CMS\Filelist\ViewHelpers\Uri\EditFileContentViewHelper\renderStatic
‪static string renderStatic(array $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: EditFileContentViewHelper.php:50
‪TYPO3\CMS\Filelist\ViewHelpers\Uri
Definition: CopyCutFileViewHelper.php:16
‪TYPO3\CMS\Core\Resource\AbstractFile
Definition: AbstractFile.php:26
‪TYPO3\CMS\Backend\Routing\UriBuilder
Definition: UriBuilder.php:38
‪TYPO3\CMS\Filelist\ViewHelpers\Uri\EditFileContentViewHelper\initializeArguments
‪initializeArguments()
Definition: EditFileContentViewHelper.php:35
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46