You are here

function nopremium_uninstall in Node Option Premium 8

Same name and namespace in other branches
  1. 6 nopremium.install \nopremium_uninstall()
  2. 7 nopremium.install \nopremium_uninstall()

Implements hook_uninstall().

File

./nopremium.install, line 11
Install, update and uninstall functions for the nopremium module.

Code

function nopremium_uninstall() {

  /** @var \Drupal\Core\Config\StorageInterface $config_storage */
  $config_storage = \Drupal::service('config.storage');

  // Get a list of all content types.
  $node_types = \Drupal::entityTypeManager()
    ->getStorage('node_type')
    ->loadMultiple();

  // Delete premium config for each content type.
  foreach ($node_types as $node_type) {
    $config_storage
      ->delete('core.base_field_override.node.' . $node_type
      ->id() . '.premium');
  }
}