unlock content types

Public

unlocks all content types, after doing something like uninstalling features.

Get raw version
php
  1. function mymodule_uninstall() {
  2. // Unlock all content types created by features.
  3. $node_types = node_type_get_types();
  4. // Go through each and unlock the content type
  5. foreach ($node_types as $node) {
  6. db_query("UPDATE {node_type} SET `custom` = 1, `locked` = 0 WHERE `type` = :ctype", array(':ctype' => $node->name));
  7. }
  8. // Clean Drupal cache; this is necessary for the "Delete" link to appear
  9. // next to the content type created by the feature.
  10. drupal_flush_all_caches();
  11. }