devel.install 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the devel module.
  5. */
  6. /**
  7. * Implements hook_requirements().
  8. */
  9. function devel_requirements($phase) {
  10. $requirements = [];
  11. if ($phase == 'runtime') {
  12. // To understand the reasons why this message is marked as info see
  13. // https://www.drupal.org/node/2834400.
  14. $requirements['devel'] = [
  15. 'title' => t('Devel module enabled'),
  16. 'description' => t('The Devel module provides access to internal debugging information; therefore it\'s recommended to disable this module on sites in production.'),
  17. 'severity' => REQUIREMENT_INFO,
  18. ];
  19. }
  20. return $requirements;
  21. }
  22. /**
  23. * Set the default devel dumper plugin.
  24. */
  25. function devel_update_8001() {
  26. $kint_enabled = \Drupal::moduleHandler()->moduleExists('kint');
  27. $default_dumper = $kint_enabled ? 'kint' : 'default';
  28. // Set the default dumper plugin to kint if kint module is available.
  29. \Drupal::configFactory()->getEditable('devel.settings')
  30. ->set('devel_dumper', $default_dumper)
  31. ->save(TRUE);
  32. }
  33. /**
  34. * Add enforced dependencies to system.menu.devel
  35. */
  36. function devel_update_8002() {
  37. $config = \Drupal::configFactory()->getEditable('system.menu.devel');
  38. $dependencies = $config->get('dependencies');
  39. $dependencies['enforced']['module'][] = 'devel';
  40. $config->set('dependencies', $dependencies)->save(TRUE);
  41. }