TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
ClickEnlargeViewHelper.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\FluidStyledContent\ViewHelpers\Link;
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 
23 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
24 
39 {
43  protected $escapeOutput = false;
44 
50  public function initializeArguments()
51  {
52  $this->registerArgument('image', FileReference::class, 'The original image file', true);
53  $this->registerArgument(
54  'configuration',
55  'mixed',
56  'String, \TYPO3\CMS\Core\Resource\File or \TYPO3\CMS\Core\Resource\FileReference with link configuration',
57  true
58  );
59  }
60 
66  public function render()
67  {
68  return self::renderStatic(
69  $this->arguments,
70  $this->buildRenderChildrenClosure(),
71  $this->renderingContext
72  );
73  }
74 
81  public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
82  {
83  $image = $arguments['image'];
84  if ($image instanceof FileInterface) {
85  self::getContentObjectRenderer()->setCurrentFile($image);
86  }
87  $configuration = self::getTypoScriptService()->convertPlainArrayToTypoScriptArray($arguments['configuration']);
88  $content = $renderChildrenClosure();
89  $configuration['enable'] = true;
90 
91  return self::getContentObjectRenderer()->imageLinkWrap($content, $image, $configuration);
92  }
93 
97  protected static function getContentObjectRenderer()
98  {
99  return $GLOBALS['TSFE']->cObj;
100  }
101 
105  protected static function getTypoScriptService()
106  {
107  static $typoScriptService;
108  if ($typoScriptService === null) {
109  $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
110  }
111  return $typoScriptService;
112  }
113 }
if(TYPO3_MODE=== 'BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']
static makeInstance($className,...$constructorArguments)