TwigTransTokenParser

A class that defines the Twig 'trans' token parser for Drupal. The token parser converts a token stream created from template source code into an Abstract Syntax Tree (AST). The AST will later be compiled into PHP code usable for runtime execution of the template. Hierarchy class \Twig_TokenParser implements \Twig_TokenParserInterface class \Drupal\Core\Template\TwigTransTokenParser See also \Twig_TokenParser http://twig.sensiolabs.org/doc/extensions/i18n.html https://github.com/fabpot/Twi

TwigSandboxPolicy::__construct

public TwigSandboxPolicy::__construct() Constructs a new TwigSandboxPolicy object. File core/lib/Drupal/Core/Template/TwigSandboxPolicy.php, line 37 Class TwigSandboxPolicy Default sandbox policy for Twig templates. Namespace Drupal\Core\Template Code public function __construct() { // Allow settings.php to override our default whitelisted classes, methods, // and prefixes. $whitelisted_classes = Settings::get('twig_sandbox_whitelisted_classes', [ // Allow any operations on t

TwigSandboxPolicy::checkSecurity

public TwigSandboxPolicy::checkSecurity($tags, $filters, $functions) Overrides Twig_Sandbox_SecurityPolicyInterface::checkSecurity File core/lib/Drupal/Core/Template/TwigSandboxPolicy.php, line 69 Class TwigSandboxPolicy Default sandbox policy for Twig templates. Namespace Drupal\Core\Template Code public function checkSecurity($tags, $filters, $functions) { }

TwigSandboxPolicy::checkPropertyAllowed

public TwigSandboxPolicy::checkPropertyAllowed($obj, $property) Overrides Twig_Sandbox_SecurityPolicyInterface::checkPropertyAllowed File core/lib/Drupal/Core/Template/TwigSandboxPolicy.php, line 74 Class TwigSandboxPolicy Default sandbox policy for Twig templates. Namespace Drupal\Core\Template Code public function checkPropertyAllowed($obj, $property) { }

TwigSandboxPolicy::checkMethodAllowed

public TwigSandboxPolicy::checkMethodAllowed($obj, $method) Overrides Twig_Sandbox_SecurityPolicyInterface::checkMethodAllowed File core/lib/Drupal/Core/Template/TwigSandboxPolicy.php, line 79 Class TwigSandboxPolicy Default sandbox policy for Twig templates. Namespace Drupal\Core\Template Code public function checkMethodAllowed($obj, $method) { foreach ($this->whitelisted_classes as $class => $key) { if ($obj instanceof $class) { return TRUE; } } // Return q

TwigSandboxPolicy::$whitelisted_prefixes

An array of whitelisted method prefixes -- any method starting with one of these prefixes will be allowed. File core/lib/Drupal/Core/Template/TwigSandboxPolicy.php, line 27 Class TwigSandboxPolicy Default sandbox policy for Twig templates. Namespace Drupal\Core\Template Code protected $whitelisted_prefixes = NULL;

TwigSandboxPolicy::$whitelisted_methods

An array of whitelisted methods in the form of methodName => TRUE. File core/lib/Drupal/Core/Template/TwigSandboxPolicy.php, line 21 Class TwigSandboxPolicy Default sandbox policy for Twig templates. Namespace Drupal\Core\Template Code protected $whitelisted_methods = NULL;

TwigSandboxPolicy::$whitelisted_classes

An array of class names for which any method calls are allowed. File core/lib/Drupal/Core/Template/TwigSandboxPolicy.php, line 32 Class TwigSandboxPolicy Default sandbox policy for Twig templates. Namespace Drupal\Core\Template Code protected $whitelisted_classes = NULL;

TwigSandboxPolicy

Default sandbox policy for Twig templates. Twig's sandbox extension is usually used to evaluate untrusted code by limiting access to potentially unsafe properties or methods. Since we do not use ViewModels when passing objects to Twig templates, we limit what those objects can do by whitelisting certain classes, method names, and method names with an allowed prefix. All object properties may be accessed. Hierarchy class \Drupal\Core\Template\TwigSandboxPolicy implements Twig_Sandbox_SecurityPol

TwigPhpStorageCache::__construct

public TwigPhpStorageCache::__construct(CacheBackendInterface $cache, $twig_extension_hash) Store cache backend and other information internally. Parameters \Drupal\Core\Cache\CacheBackendInterface $cache: The cache bin. string $twig_extension_hash: The Twig extension hash. File core/lib/Drupal/Core/Template/TwigPhpStorageCache.php, line 49 Class TwigPhpStorageCache Provides an alternate cache storage for Twig using PhpStorage. Namespace Drupal\Core\Template Code public function __con