You are here

function node_type_example_uninstall in Examples for Developers 3.x

Same name and namespace in other branches
  1. 8 node_type_example/node_type_example.install \node_type_example_uninstall()

Implements hook_uninstall().

Our content types will live on in the Drupal installation, even after this module is uninstalled. This is a good thing, since it allows the user to make decisions about their fate. Therefore we should give the user the option of deleting them.

Since we told Drupal that our locked_content_type is locked, we now have to tell it to unlock.

Related topics

File

modules/node_type_example/node_type_example.install, line 38
Install file for node_type_example.

Code

function node_type_example_uninstall() {

  // Allow locked_content_type to be deleted.
  $locked = Drupal::state()
    ->get('node.type.locked');
  unset($locked['locked_content_type']);
  Drupal::state()
    ->set('node.type.locked', $locked);
}