function commerce_bulk_uninstall in Commerce Bulk 8
Implements hook_uninstall().
File
- ./
commerce_bulk.install, line 54 - Install and uninstall functions for the commerce_bulk module.
Code
function commerce_bulk_uninstall() {
$config = \Drupal::configFactory();
$all = $config
->listAll('core.entity_form_display.commerce_product_variation.');
foreach ($all as $name) {
$variation = $config
->getEditable($name);
$sku = $variation
->get('content.sku');
$sku['type'] = 'string_textfield';
unset($sku['settings']['custom_label'], $sku['settings']['uniqid_enabled'], $sku['settings']['more_entropy'], $sku['settings']['hide'], $sku['settings']['prefix'], $sku['settings']['suffix'], $sku['settings']['maximum']);
$variation
->set('content.sku', $sku);
$variation
->save();
}
$configurations = [
'system.action.commerce_bulk_attribute_value_name',
'system.action.commerce_bulk_attribute_value_top',
'system.action.commerce_bulk_attribute_value_zdelete',
'system.action.commerce_bulk_variation_duplicate',
'system.action.commerce_bulk_variation_hook',
'system.action.commerce_bulk_variation_priceadjust',
'system.action.commerce_bulk_variation_priceset',
'system.action.commerce_bulk_variation_sku',
'system.action.commerce_bulk_variation_status',
'system.action.commerce_bulk_variation_top',
'system.action.commerce_bulk_variation_zdelete',
'system.action.commerce_bulk_term_duplicate',
'system.action.commerce_bulk_term_zdelete',
'system.action.commerce_bulk_order_zanonymize',
'views.view.commerce_bulk_attributes',
'views.view.commerce_bulk_variations_tab',
'views.view.commerce_bulk_taxonomy',
];
foreach ($configurations as $name) {
if ($configuration = $config
->getEditable($name)) {
$configuration
->delete();
}
}
}