You are here

function total_control_uninstall in Total Control Admin Dashboard 6.2

Same name and namespace in other branches
  1. 7.2 total_control.install \total_control_uninstall()

Implementation of hook_uninstall

File

./total_control.install, line 93
total_control.install

Code

function total_control_uninstall() {
  $views = views_get_all_views();
  foreach ($views as $view_name => $view) {

    // Remove any views that have been overridden
    $views_types = array(
      'Overridden',
      'Normal',
    );
    $total_control_views = array(
      'control_content',
      'control_content_panes',
      'control_comments',
      'control_files',
      'control_revisions',
      'control_terms',
      'control_users',
      'control_users_panes',
    );
    if (in_array($view->type, $views_types) && in_array($view_name, $total_control_views)) {
      drupal_set_message(t('Deleting view: %view', array(
        '%view' => $view_name,
      )));
      $view
        ->delete();
      views_object_cache_clear('view', $view_name);
    }
  }
  variable_del('total_control_type_panels');
  variable_del('total_control_type_pages');
  variable_del('total_control_role_panels');
  variable_del('total_control_role_pages');
  variable_del('total_control_auto_panels');
  variable_del('total_control_auto_pages');
}