‪TYPO3CMS  9.5
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 
21 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
22 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
23 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
24 
40 class ‪ClickEnlargeViewHelper extends AbstractViewHelper
41 {
42  use CompileWithRenderStatic;
43 
47  protected ‪$escapeOutput = false;
48 
52  public function ‪initializeArguments()
53  {
54  $this->registerArgument('image', FileInterface::class, 'The original image file', true);
55  $this->registerArgument(
56  'configuration',
57  'mixed',
58  'String, \TYPO3\CMS\Core\Resource\File or \TYPO3\CMS\Core\Resource\FileReference with link configuration',
59  true
60  );
61  }
62 
69  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
70  {
71  $image = $arguments['image'];
72  if ($image instanceof ‪FileInterface) {
74  }
75  $configuration = ‪self::getTypoScriptService()->‪convertPlainArrayToTypoScriptArray($arguments['configuration']);
76  $content = $renderChildrenClosure();
77  $configuration['enable'] = true;
78 
79  return ‪self::getContentObjectRenderer()->‪imageLinkWrap($content, $image, $configuration);
80  }
81 
85  protected static function ‪getContentObjectRenderer()
86  {
87  return ‪$GLOBALS['TSFE']->cObj;
88  }
89 
93  protected static function ‪getTypoScriptService(): ‪TypoScriptService
94  {
95  return GeneralUtility::makeInstance(TypoScriptService::class);
96  }
97 }
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\setCurrentFile
‪setCurrentFile($fileObject)
Definition: ContentObjectRenderer.php:1511
‪TYPO3\CMS\Core\Resource\FileInterface
Definition: FileInterface.php:21
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer\imageLinkWrap
‪string imageLinkWrap($string, $imageFile, $conf)
Definition: ContentObjectRenderer.php:1257
‪TYPO3\CMS\Core\TypoScript\TypoScriptService\convertPlainArrayToTypoScriptArray
‪array convertPlainArrayToTypoScriptArray(array $plainArray)
Definition: TypoScriptService.php:65
‪TYPO3\CMS\Core\TypoScript\TypoScriptService
Definition: TypoScriptService.php:23
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:91
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45