You are here

function basic_cart_uninstall in Basic cart 7.3

Same name and namespace in other branches
  1. 7 basic_cart.install \basic_cart_uninstall()
  2. 7.2 basic_cart.install \basic_cart_uninstall()

Implements hook_uninstall().

File

./basic_cart.install, line 81
Basic cart install file

Code

function basic_cart_uninstall() {

  // Currency.
  variable_del('basic_cart_currency');

  // Delete the price field.
  $types = variable_get('basic_cart_content_types');
  if (is_array($types)) {
    drupal_load('module', 'basic_cart');

    // Foreach selected content type, delete the price field.
    foreach ($types as $type => $checked) {
      if (!empty($checked)) {
        foreach (basic_cart_get_fields() as $field_name => $field_) {

          // Price instance.
          $instance = array(
            'field_name' => $field_name,
            'entity_type' => 'node',
            'bundle' => $type,
          );
          field_delete_instance($instance);
        }
      }
    }
  }

  // Delete the content types from the variables table.
  variable_del('basic_cart_content_types');

  // Admin confirmation mail.
  variable_del('basic_cart_admin_subject');
  variable_del('basic_cart_admin_message');

  // User confirmation email.
  variable_del('basic_cart_user_subject');
  variable_del('basic_cart_user_message');
  variable_del('basic_cart_send_user_message');

  // Thank you messages.
  variable_del('basic_cart_thank_you_title');
  variable_del('basic_cart_thank_you_message');

  // Redirect user after add to cart action.
  variable_del('basic_cart_redirect_user_after_add_to_cart');

  // VAT default state and value.
  variable_del('basic_cart_vat_state');
  variable_del('basic_cart_vat_value');
}