function workbench_moderation_actions_uninstall in Workbench Moderation Actions 8
Implements hook_uninstall().
File
- ./
workbench_moderation_actions.install, line 41 - Contains workbench_moderation.install.
Code
function workbench_moderation_actions_uninstall() {
// Restore the publish/unpublished actions.
$node_actions_to_restore = [
'node_publish_action',
'node_unpublish_action',
];
foreach ($node_actions_to_restore as $action) {
if (!Action::load($action)) {
$entity_type_manager = \Drupal::entityTypeManager();
$module_handler = \Drupal::moduleHandler();
// Restore the action from the original config from the node module.
$config_install_path = $module_handler
->getModule('node')
->getPath() . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY;
$storage = new FileStorage($config_install_path);
$entity_type_manager
->getStorage('action')
->create($storage
->read('system.action.' . $action))
->trustData()
->save();
}
}
}