Added missing modules, including some as submodules.
[yaffs-website] / web / modules / contrib / devel / kint / kint.module
1 <?php
2
3 use Drupal\Core\Render\Markup;
4
5 /**
6  * Alias of Kint::dump().
7  *
8  * Prints passed argument(s) using Kint debug tool.
9  */
10 function kint() {
11   kint_require();
12   if (\Drupal::currentUser()->hasPermission('access kint')) {
13     $args = func_get_args();
14     if (PHP_SAPI === 'cli') {
15       s($args);
16     }
17     else {
18       \Kint::dump($args);
19     }
20   }
21 }
22
23 /**
24  * Alias of Kint::trace().
25  *
26  * Prints backtrace in Kint debug tool.
27  */
28 function kint_trace() {
29   kint_require();
30   if (\Drupal::currentUser()->hasPermission('access kint')) {
31     call_user_func_array(array('Kint', 'trace'), array());
32   }
33 }
34
35 /**
36  * Alias of Kint::kintLite().
37  *
38  * Prints with lightweight formatting, using whitespace for formatting instead
39  * of HTML.
40  */
41 function kint_lite() {
42   if (\Drupal::currentUser()->hasPermission('access kint')) {
43     $args = func_get_args();
44     call_user_func_array('kintLite', $args);
45   }
46 }
47
48 /**
49  * Prints passed argument(s) to the 'message' area of the page.
50  */
51 function ksm() {
52   kint_require();
53   if (\Drupal::currentUser()->hasPermission('access kint')) {
54     $args = func_get_args();
55     $msg = @Kint::dump($args);
56     drupal_set_message(Markup::create($msg));
57   }
58 }
59
60 /**
61  * Load the Kint class.
62  */
63 function kint_require() {
64   return require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'kint') . '/kint/Kint.class.php';
65 }