Attention
TYPO3 v12 has reached end-of-life as of April 30th 2026 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v12 here: TYPO3 ELTS.
Constant ViewHelper <f:constant>
Wrapper for PHPs
constant function.
See https://www.php.net/manual/function.constant.php.
Examples
Get built-in PHP constant
{f:constant(name: 'PHP_INT_MAX')}
Copied!
Output:
9223372036854775807
(Depending on CPU architecture).
Copied!
Get class constant
{f:constant(name: '\Vendor\Package\Class::CONSTANT')}
Copied!
Get enum value
{f:constant(name: '\Vendor\Package\Enum::CASE')}
Copied!
Go to the source code of this ViewHelper: ConstantViewHelper.php (GitHub).
Arguments
The following arguments are available for the constant ViewHelper:
name
-
- Type
- string
String representation of a PHP constant or enum