-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConfigurationViewHelper.php
56 lines (43 loc) · 1.49 KB
/
ConfigurationViewHelper.php
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
48
49
50
51
52
53
54
55
56
<?php
declare(strict_types=1);
namespace Filoucrackeur\StorageFrameworkManager\ViewHelpers;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
class ConfigurationViewHelper extends AbstractViewHelper
{
/**
* @var bool
*/
protected $escapeOutput = false;
/**
* @var bool
*/
protected $escapeChildren = false;
/**
* Initialize arguments.
*/
public function initializeArguments()
{
parent::initializeArguments();
$this->registerArgument('type', 'string', 'Backend type session or cache', true);
$this->registerArgument('identifier', 'string', 'Cache identifier', false, null);
}
/**
* @return array|null
*/
public function render(): ?array
{
if ($this->arguments['type'] === 'cache') {
if (isset($this->arguments['identifier']) && '' !== $this->arguments['identifier']) {
return $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'][$this->arguments['identifier']];
}
return $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'];
}
if ($this->arguments['type'] === 'session') {
if (isset($this->arguments['identifier']) && '' !== $this->arguments['identifier']) {
return $GLOBALS['TYPO3_CONF_VARS']['SYS']['session'][$this->arguments['identifier']];
}
return $GLOBALS['TYPO3_CONF_VARS']['SYS']['session'];
}
return null;
}
}