function Debug::getFunctions

Same name in other branches
  1. 4.x src/Twig/Extension/Debug.php \Drupal\devel\Twig\Extension\Debug::getFunctions()

File

src/Twig/Extension/Debug.php, line 46

Class

Debug
Provides the Devel debugging function within Twig templates.

Namespace

Drupal\devel\Twig\Extension

Code

public function getFunctions() {
    $options = [
        'is_safe' => [
            'html',
        ],
        'needs_environment' => TRUE,
        'needs_context' => TRUE,
        'is_variadic' => TRUE,
    ];
    return [
        new TwigFunction('devel_dump', [
            $this,
            'dump',
        ], $options),
        new TwigFunction('kpr', [
            $this,
            'dump',
        ], $options),
        // Preserve familiar kint() function for dumping.
new TwigFunction('kint', [
            $this,
            'kint',
        ], $options),
        new TwigFunction('devel_message', [
            $this,
            'message',
        ], $options),
        new TwigFunction('dpm', [
            $this,
            'message',
        ], $options),
        new TwigFunction('dsm', [
            $this,
            'message',
        ], $options),
        new TwigFunction('devel_breakpoint', [
            $this,
            'breakpoint',
        ], [
            'needs_environment' => TRUE,
            'needs_context' => TRUE,
            'is_variadic' => TRUE,
        ]),
    ];
}