summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon Bergren2008-09-19 17:42:47 (GMT)
committer Brandon Bergren2008-09-19 17:42:47 (GMT)
commitebf00e878955d66d46f4563580f5db10a57b6199 (patch)
tree5e681d0347cd16b118a6ea2d2b158b947a12b292
parent0c1eb3e1c3736d9b08688a5df0aa994f0c06967e (diff)
Add type synchronization in location_addanother.module.
-rw-r--r--contrib/location_addanother/location_addanother.module19
1 files changed, 18 insertions, 1 deletions
diff --git a/contrib/location_addanother/location_addanother.module b/contrib/location_addanother/location_addanother.module
index 8e52e5c..efe5db5 100644
--- a/contrib/location_addanother/location_addanother.module
+++ b/contrib/location_addanother/location_addanother.module
@@ -95,4 +95,21 @@ function location_addanother_form_submit($form_id, &$form_values) {
return 'node/'. $node->nid;
}
-// @@@ @todo Type synchronization.
+/**
+ * Implementation of hook_node_type().
+ * Synchronize our settings.
+ */
+function location_addanother_node_type($op, $info) {
+ switch ($op) {
+ case 'delete':
+ variable_del('location_addanother_'. $info->type);
+ break;
+ case 'update':
+ if (!empty($info->old_type) && $info->old_type != $info->type) {
+ $setting = variable_get('location_addanother_'. $info->old_type, 0);
+ variable_del('location_addanother_'. $info->old_type);
+ variable_set('location_addanother_'. $info->type, $setting);
+ }
+ break;
+ }
+}