You are here

function panels_everywhere_uninstall in Panels Everywhere 6

Same name and namespace in other branches
  1. 7 panels_everywhere.install \panels_everywhere_uninstall()

Implements hook_uninstall().

File

./panels_everywhere.install, line 10
Installation, update and uninstall hooks for Panels Everywhere.

Code

function panels_everywhere_uninstall() {

  // Delete the variables.
  variable_del('panels_everywhere_head_title_include_name');
  variable_del('panels_everywhere_head_title_include_slogan');
  variable_del('panels_everywhere_head_title_separator');
  variable_del('panels_everywhere_provide_sample');
  variable_del('panels_everywhere_site_template_enabled');
  variable_del('panels_everywhere_site_template_enabled_admin');
  variable_del('panels_everywhere_site_template_per_theme');
  foreach (system_theme_data() as $theme) {
    variable_del('panels_everywhere_override_theme_' . $theme->name);
  }

  // Delete the variant(s).
  // Steps:
  // 1. Query {page_manager_handlers} for any records with 'task' ==
  //   'site_template'.
  $templates = db_query("SELECT did, conf\n    FROM {page_manager_handlers} h\n    WHERE task='site_template'");
  while ($site_template = db_fetch_object($templates)) {

    // 2. Extract the 'conf' field using unserialize(), obtain the 'did' value.
    $site_template->conf = unserialize($site_template->conf);

    // 3. Delete the display referenced above.
    panels_delete_display($site_template->conf['did']);

    // 4. Delete the site template record.
    db_query("DELETE FROM {page_manager_handlers}\n      WHERE task='site_template'\n        AND did=%d", array(
      $site_template->did,
    ));
  }
  drupal_set_message(t('Removed the Panels Everywhere site templates.'));
}