TYPO3 CMS  TYPO3_8-7
ClickEnlargeViewHelper.php
Go to the documentation of this file.
1 <?php
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 
24 
39 {
43  protected $escapeOutput = false;
44 
48  public function initializeArguments()
49  {
50  $this->registerArgument('image', FileReference::class, 'The original image file', true);
51  $this->registerArgument(
52  'configuration',
53  'mixed',
54  'String, \TYPO3\CMS\Core\Resource\File or \TYPO3\CMS\Core\Resource\FileReference with link configuration',
55  true
56  );
57  }
58 
64  public function render()
65  {
66  return self::renderStatic(
67  $this->arguments,
68  $this->buildRenderChildrenClosure(),
69  $this->renderingContext
70  );
71  }
72 
79  public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
80  {
81  $image = $arguments['image'];
82  if ($image instanceof FileInterface) {
83  self::getContentObjectRenderer()->setCurrentFile($image);
84  }
85  $configuration = self::getTypoScriptService()->convertPlainArrayToTypoScriptArray($arguments['configuration']);
86  $content = $renderChildrenClosure();
87  $configuration['enable'] = true;
88 
89  return self::getContentObjectRenderer()->imageLinkWrap($content, $image, $configuration);
90  }
91 
95  protected static function getContentObjectRenderer()
96  {
97  return $GLOBALS['TSFE']->cObj;
98  }
99 
103  protected static function getTypoScriptService()
104  {
105  static $typoScriptService;
106  if ($typoScriptService === null) {
107  $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
108  }
109  return $typoScriptService;
110  }
111 }
static makeInstance($className,... $constructorArguments)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']