function DebugExtension::getFunctions

Same name in other branches
  1. 10 core/lib/Drupal/Core/Template/DebugExtension.php \Drupal\Core\Template\DebugExtension::getFunctions()
  2. 11.x core/lib/Drupal/Core/Template/DebugExtension.php \Drupal\Core\Template\DebugExtension::getFunctions()

File

core/lib/Drupal/Core/Template/DebugExtension.php, line 26

Class

DebugExtension
A class providing Drupal Twig Debug extension.

Namespace

Drupal\Core\Template

Code

public function getFunctions() : array {
    // Override Twig built in debugger when Symfony VarDumper is available to
    // improve developer experience.
    // @see \Twig\Extension\DebugExtension
    // @see \Symfony\Component\VarDumper\VarDumper
    if (class_exists(self::SYMFONY_VAR_DUMPER_CLASS)) {
        return [
            new TwigFunction('dump', [
                self::class,
                'dump',
            ], [
                'needs_context' => TRUE,
                'needs_environment' => TRUE,
                'is_variadic' => TRUE,
            ]),
        ];
    }
    return [];
}

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