function TwigSandboxPolicy::getMethodsAllowedOnAllObjects

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Template/TwigSandboxPolicy.php \Drupal\Core\Template\TwigSandboxPolicy::getMethodsAllowedOnAllObjects()

Gets the list of allowed methods on all objects.

Return value

string[] The list of allowed methods on all objects.

2 calls to TwigSandboxPolicy::getMethodsAllowedOnAllObjects()
TwigExtension::getNodeVisitors in core/lib/Drupal/Core/Template/TwigExtension.php
TwigSandboxPolicy::__construct in core/lib/Drupal/Core/Template/TwigSandboxPolicy.php
Constructs a new TwigSandboxPolicy object.

File

core/lib/Drupal/Core/Template/TwigSandboxPolicy.php, line 113

Class

TwigSandboxPolicy
Default sandbox policy for Twig templates.

Namespace

Drupal\Core\Template

Code

public static function getMethodsAllowedOnAllObjects() : array {
    return Settings::get('twig_sandbox_allowed_methods', [
        // Only allow idempotent methods.
'id',
        'label',
        'bundle',
        'get',
        '__toString',
        'toString',
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.