function 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 drupal/core/vendor/twig/twig/lib/Twig/Extension/Core.php
Returns a list of global functions to add to the existing list.

File

drupal/core/vendor/twig/twig/lib/Twig/Extension/Core.php, line 1307

Code

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