TYPO3
7.6
Users
bogdan
Projects
Kapeli
Resources
Dash
Docsets
TYPO3
src
typo3
sysext
fluid_styled_content
Classes
ViewHelpers
Link
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
17
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
18
use
TYPO3\CMS\Extbase\Service\TypoScriptService
;
19
use
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
;
20
use
TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
;
21
use
TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface
;
22
36
class
ClickEnlargeViewHelper
extends
AbstractViewHelper
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,
63
$this->
buildRenderChildrenClosure
(),
64
$this->renderingContext
65
);
66
}
67
74
public
static
function
renderStatic
(array
$arguments
, \Closure
$renderChildrenClosure
,
RenderingContextInterface
$renderingContext
)
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
}
Generated on Wed Nov 11 2015 01:51:51 for TYPO3 by
1.8.3