You are here

public function Debug::getFunctions in Devel 4.x

Same name and namespace in other branches
  1. 8.3 src/Twig/Extension/Debug.php \Drupal\devel\Twig\Extension\Debug::getFunctions()
  2. 8 src/Twig/Extension/Debug.php \Drupal\devel\Twig\Extension\Debug::getFunctions()
  3. 8.2 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,
    ]),
  ];
}