You are here

public function Debug::getFunctions in Devel 8

Same name and namespace in other branches
  1. 8.3 src/Twig/Extension/Debug.php \Drupal\devel\Twig\Extension\Debug::getFunctions()
  2. 8.2 src/Twig/Extension/Debug.php \Drupal\devel\Twig\Extension\Debug::getFunctions()
  3. 4.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() {
  $functions = [];
  foreach ([
    'devel_dump',
    'kpr',
  ] as $function) {
    $functions[] = new \Twig_SimpleFunction($function, [
      $this,
      'dump',
    ], [
      'is_safe' => [
        'html',
      ],
      'needs_environment' => TRUE,
      'needs_context' => TRUE,
      'is_variadic' => TRUE,
    ]);
  }
  foreach ([
    'devel_message',
    'dpm',
    'dsm',
  ] as $function) {
    $functions[] = new \Twig_SimpleFunction($function, [
      $this,
      'message',
    ], [
      'is_safe' => [
        'html',
      ],
      'needs_environment' => TRUE,
      'needs_context' => TRUE,
      'is_variadic' => TRUE,
    ]);
  }
  foreach ([
    'devel_breakpoint',
  ] as $function) {
    $functions[] = new \Twig_SimpleFunction($function, [
      $this,
      'breakpoint',
    ], [
      'needs_environment' => TRUE,
      'needs_context' => TRUE,
      'is_variadic' => TRUE,
    ]);
  }
  return $functions;
}