workflow_admin_ui.install 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the workflow_admin_ui module.
  5. *
  6. */
  7. /**
  8. * Implements hook_enable().
  9. */
  10. function workflow_admin_ui_enable() {
  11. drupal_set_message(_workflow_admin_ui_participate());
  12. }
  13. /**
  14. * Helper function. Used both by update and enable.
  15. */
  16. function _workflow_admin_ui_participate() {
  17. $perms = array('participate in workflow' => 1);
  18. foreach (user_roles() as $rid => $name) {
  19. user_role_change_permissions($rid, $perms);
  20. }
  21. return t('Please review which roles may participate in workflows. <a href="!url">Permissions</a>',
  22. array('!url' => url('admin/people/permissions', array('fragment' => 'module-workflow_admin_ui'))));
  23. }
  24. /**
  25. * Patch for #1540824 requires that the menu be rebuilt.
  26. */
  27. function workflow_admin_ui_update_7000(&$sandbox) {
  28. menu_rebuild();
  29. return t('Workflow_admin_ui requested a menu rebuild.');
  30. }
  31. /**
  32. * Give all user roles the ability to participate in workflows.
  33. */
  34. function workflow_admin_ui_update_7001(&$sandbox) {
  35. return _workflow_admin_ui_participate();
  36. }