webprofiler.module 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * @file
  4. * Legacy Webprofiler module file.
  5. */
  6. /**
  7. * Implements hook_theme().
  8. */
  9. function webprofiler_theme() {
  10. return [
  11. 'webprofiler_loader' => [
  12. 'template' => 'Profiler/webprofiler_loader',
  13. 'variables' => ['token' => NULL, 'profiler_url' => NULL],
  14. ],
  15. 'webprofiler_toolbar' => [
  16. 'template' => 'Profiler/webprofiler_toolbar',
  17. 'variables' => [
  18. 'token' => NULL,
  19. 'toolbar' => NULL,
  20. ],
  21. ],
  22. 'webprofiler_panel' => [
  23. 'template' => 'Profiler/webprofiler_panel',
  24. 'variables' => [
  25. 'panel' => NULL,
  26. ],
  27. ],
  28. 'webprofiler_dashboard' => [
  29. 'template' => 'Profiler/webprofiler_dashboard',
  30. 'variables' => [
  31. 'profile' => [],
  32. 'panels' => [],
  33. 'spinner_path' => NULL,
  34. ],
  35. ],
  36. ];
  37. }
  38. /**
  39. * Implements hook_cache_flush().
  40. */
  41. function webprofiler_cache_flush() {
  42. $config = \Drupal::configFactory()->get('webprofiler.config');
  43. if ($config->get('purge_on_cache_clear')) {
  44. $profiler = \Drupal::service('profiler');
  45. $profiler->purge();
  46. }
  47. }