function Debug::getFunctions

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

File

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

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 \Twig_SimpleFunction('devel_dump', [
            $this,
            'dump',
        ], $options),
        new \Twig_SimpleFunction('kpr', [
            $this,
            'dump',
        ], $options),
        // Preserve familiar kint() function for dumping.
new \Twig_SimpleFunction('kint', [
            $this,
            'kint',
        ], $options),
        new \Twig_SimpleFunction('devel_message', [
            $this,
            'message',
        ], $options),
        new \Twig_SimpleFunction('dpm', [
            $this,
            'message',
        ], $options),
        new \Twig_SimpleFunction('dsm', [
            $this,
            'message',
        ], $options),
        new \Twig_SimpleFunction('devel_breakpoint', [
            $this,
            'breakpoint',
        ], [
            'needs_environment' => TRUE,
            'needs_context' => TRUE,
            'is_variadic' => TRUE,
        ]),
    ];
}