Skip to content

Commit

Permalink
[FEATURE] Constant viewhelper (FluidTYPO3#1095)
Browse files Browse the repository at this point in the history
This viewhelper renders PHP constants
  • Loading branch information
bjo3rnf authored and cedricziel committed Aug 18, 2016
1 parent 3ae5313 commit 4c3fafc
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Classes/ViewHelpers/ConstViewHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
namespace FluidTYPO3\Vhs\ViewHelpers;

/*
* This file is part of the FluidTYPO3/Vhs 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 TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;

/**
* ### Const ViewHelper
*
* Renders the value of a PHP constant
*/
class ConstViewHelper extends AbstractViewHelper
{

/**
* @param string $name
* @return mixed
*/
public function render($name)
{
if ($name === null) {
$name = $this->renderChildren();
}
return constant($name);
}
}

0 comments on commit 4c3fafc

Please sign in to comment.