Skip to content

Instantly share code, notes, and snippets.

@nikunjkotecha
Created April 11, 2017 06:17
Show Gist options
  • Save nikunjkotecha/8421584850d5878b43657902fb321873 to your computer and use it in GitHub Desktop.
Save nikunjkotecha/8421584850d5878b43657902fb321873 to your computer and use it in GitHub Desktop.
Drupal 8 - using update hook to revert view
<?php
/**
* @file
* Contains install, update, uninstall hooks for mymodule module.
*/
/**
* Implements hook_update_N().
*
* Revert views config - assuming the config name is views.view.product_category_level_3.yml.
*/
function mymodule_update_8000() {
$reverter = \Drupal::service('config_update.config_update');
$reverter->revert('view', 'product_category_level_3');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment