-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVariableViewHelper.php
More file actions
47 lines (40 loc) · 1.06 KB
/
Copy pathVariableViewHelper.php
File metadata and controls
47 lines (40 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
namespace Fab\Formule\ViewHelpers;
/*
* This file is part of the Fab/Formule project under GPLv2 or later.
*
* For the full copyright and license information, please read the
* LICENSE.md file that was distributed with this source code.
*/
use Fab\Formule\Service\FlashMessageQueue;
use Fab\Formule\Service\TemplateService;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* View helper which returns variables.
*/
class VariableViewHelper extends AbstractViewHelper
{
/**
* @return void
*/
public function initializeArguments(): void
{
$this->registerArgument('name', 'string', '', true);
}
/**
* @return array
*/
public function render(): array
{
$name = $this->arguments['name'];
return $this->getTemplateService()->getVariable($name);
}
/**
* @return TemplateService
*/
protected function getTemplateService(): TemplateService
{
return GeneralUtility::makeInstance(TemplateService::class);
}
}