You are here

function total_control_uninstall in Total Control Admin Dashboard 7.2

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

Implements hook_uninstall

File

./total_control.install, line 103
total_control.install

Code

function total_control_uninstall() {
  $views = views_get_all_views();

  // Delete the dashboard 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();
      module_load_include('inc', 'ctools', 'includes/object-cache');
      ctools_object_cache_clear('view', $view_name);
    }
  }

  // @TODO delete the dashboard panel too?
  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');
}