Skip to content

Commit

Permalink
[BUGFIX] use initializeArguments to access constants
Browse files Browse the repository at this point in the history
  • Loading branch information
kaystrobach authored Oct 8, 2022
1 parent cf7614d commit a4b50bd
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Classes/ViewHelpers/ConstantViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@
*/
class ConstantViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {

/**
* Initialize arguments.
*
* @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
*/
public function initializeArguments()
{
$this->registerArgument('constant', 'string', 'the constant path', false, '');
}

/**
* Gets a constant
*
Expand All @@ -30,8 +40,10 @@ class ConstantViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHe
* (depending on your domain)
* </output>
*/
public function render($constant = '') {

public function render()
{
$constant = $this->arguments['constant'];

$pageWithTheme = \KayStrobach\Themes\Utilities\FindParentPageWithThemeUtility::find($this->getFrontendController()->id);
$pageLanguage = (int)GeneralUtility::_GP('L');
// instantiate the cache
Expand Down Expand Up @@ -80,7 +92,8 @@ public function render($constant = '') {
/**
* @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
*/
public function getFrontendController() {
public function getFrontendController()
{
return $GLOBALS['TSFE'];
}
}

0 comments on commit a4b50bd

Please sign in to comment.