You are here

function workbench_moderation_uninstall in Workbench Moderation 7

Same name and namespace in other branches
  1. 7.3 workbench_moderation.install \workbench_moderation_uninstall()

Implements hook_uninstall().

File

./workbench_moderation.install, line 23
Install file for the Workbench Moderation module.

Code

function workbench_moderation_uninstall() {

  // Delete workbench_moderation variables.
  variable_del('workbench_moderation_nodedraft_disabled');
  variable_del('workbench_moderation_per_node_type');
  variable_del('workbench_moderation_show_revision_navigation');

  // Get all node types. Loop through them and delete workbench-related variables.
  $types = node_type_get_types();
  foreach ($types as $type_object) {
    $type = $type_object->type;
    variable_del("workbench_moderation_default_state_{$type}");

    // Get node options that might hold a moderation flag.
    $node_options = variable_get("node_options_{$type}", array());
    foreach ($node_options as $key => $option) {
      if ($option === 'moderation') {
        unset($node_options[$key]);
      }
    }
    variable_set("node_options_{$type}", $node_options);
  }
}