Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / field_attach_delete_bundle.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete_bundle.twig b/vendor/chi-teck/drupal-code-generator/templates/d7/hook/field_attach_delete_bundle.twig
new file mode 100644 (file)
index 0000000..9a9ce94
--- /dev/null
@@ -0,0 +1,11 @@
+/**
+ * Implements hook_field_attach_delete_bundle().
+ */
+function {{ machine_name }}_field_attach_delete_bundle($entity_type, $bundle, $instances) {
+  // Remove the extra weights variable information for this bundle.
+  $extra_weights = variable_get('field_extra_weights', array());
+  if (isset($extra_weights[$entity_type][$bundle])) {
+    unset($extra_weights[$entity_type][$bundle]);
+    variable_set('field_extra_weights', $extra_weights);
+  }
+}