Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DebugExtension.php

function DebugExtension::getFunctions

Same name in this branch
  1. 11.1.x vendor/twig/twig/src/Extension/DebugExtension.php \Twig\Extension\DebugExtension::getFunctions()

Overrides AbstractExtension::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 [];
}
RSS feed
Powered by Drupal