TYPO3  7.6
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 
22 
37 {
43  public function initializeArguments()
44  {
45  $this->registerArgument('image', '', 'The original image file', true);
46  $this->registerArgument(
47  'configuration',
48  'mixed',
49  'String, \TYPO3\CMS\Core\Resource\File or \TYPO3\CMS\Core\Resource\FileReference with link configuration',
50  true
51  );
52  }
53 
59  public function render()
60  {
61  return self::renderStatic(
62  $this->arguments,
64  $this->renderingContext
65  );
66  }
67 
75  {
76  $image = $arguments['image'];
77  $configuration = self::getTypoScriptService()->convertPlainArrayToTypoScriptArray($arguments['configuration']);
78  $content = $renderChildrenClosure();
79  $configuration['enable'] = true;
80 
81  return self::getContentObjectRenderer()->imageLinkWrap($content, $image, $configuration);
82  }
83 
87  protected static function getContentObjectRenderer()
88  {
89  return $GLOBALS['TSFE']->cObj;
90  }
91 
95  protected static function getTypoScriptService()
96  {
97  static $typoScriptService;
98  if ($typoScriptService === null) {
99  $typoScriptService = GeneralUtility::makeInstance(TypoScriptService::class);
100  }
101  return $typoScriptService;
102  }
103 }