You are here

function twig_constant in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Extension/Core.php \twig_constant()

Provides the ability to get constants from instances as well as class/global constants.

Parameters

string $constant The name of the constant:

null|object $object The object to get the constant from:

Return value

string

1 string reference to 'twig_constant'
Twig_Extension_Core::getFunctions in vendor/Twig/Extension/Core.php
Returns a list of global functions to add to the existing list.

File

vendor/Twig/Extension/Core.php, line 1460

Code

function twig_constant($constant, $object = null) {
  if (null !== $object) {
    $constant = get_class($object) . '::' . $constant;
  }
  return constant($constant);
}