? settings_node_form_rearrange.patch
Index: node_form_rearrange.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/node_form_rearrange/node_form_rearrange.module,v
retrieving revision 1.2
diff -u -p -r1.2 node_form_rearrange.module
--- node_form_rearrange.module	17 Nov 2008 22:55:04 -0000	1.2
+++ node_form_rearrange.module	13 May 2009 10:15:53 -0000
@@ -8,41 +8,77 @@
  */
 
 /**
+ * Implementation of hook_menu().
+ */
+function node_form_rearrange_menu() {
+  $items = array();
+  $items['admin/settings/node-form-rearrange'] = array(
+    'title' => 'Node Form Rearrange Settings',
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('node_form_rearrange_settings'),
+    'access arguments' => array('administer nodes'),
+    'type' => MENU_NORMAL_ITEM,
+  );
+  return $items;
+}
+
+/**
+ * Form builder
+ * Implementation of hook_settings().
+ */
+function node_form_rearrange_settings() {
+  $form = array();
+  $types = node_get_types('names');
+  $form['node_form_rearrange_content_types'] = array(
+    '#type' => 'checkboxes',
+    '#description' => 'Check the content types for which you want to use the Form Rearrange Functions',
+    '#title' => t('Rearrange Content Types'),
+    '#options' => $types,
+    '#default_value' => variable_get('node_form_rearrange_content_types', array(0)),
+    '#required' => TRUE,
+  );
+  return system_settings_form($form);
+}
+
+
+/**
  * Implementation of hook_form_alter().
  */
 
 function node_form_rearrange_form_alter(&$form, $form_state, $form_id) {
   if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
-    //retrieve all vocabularies for this node's content type
-    $vocabularies = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s'
-ORDER BY v.weight, v.name", 'v', 'vid'), $form['type']['#value']);
-    //loop through vocabularies, moving their form element out of the taxonomy fieldset
-    while ($vocabulary = db_fetch_object($vocabularies)) {
-    //check to see if non-tag vocabularies exist 
-    if ($form['taxonomy'][$vocabulary->vid]) {
-        $field = $form['taxonomy'][$vocabulary->vid];
-        unset($form['taxonomy'][$vocabulary->vid]);
-        $form["taxonomy_field_$vocabulary->vid"] = $field;
-      }
-      //check to see if tag vocabularies exist
-      if ($form['taxonomy']['tags'][$vocabulary->vid]) {
-        $field = $form['taxonomy']['tags'][$vocabulary->vid];
-        unset($form['taxonomy']['tags'][$vocabulary->vid]);
-        $form["taxonomy_field_tags_$vocabulary->vid"] = $field;
-      }
-      // Direct copy from content.module, for setting the weight of fields based on arrangement in admin/content/node-type/[content type]/fields
-      $type = content_types($form['type']['#value']);
-      foreach ($type['extra'] as $key => $value) {
-        if (isset($form[$key])) {
-          $form[$key]['#weight'] = $value['weight'];
+  	$types = variable_get('node_form_rearrange_content_types', array(0));
+  	if(isset($types[$form['type']['#value']]) && ($types[$form['type']['#value']] != '0')) {
+      //retrieve all vocabularies for this node's content type
+      $vocabularies = db_query(db_rewrite_sql("SELECT v.* FROM {vocabulary} v INNER JOIN {vocabulary_node_types} n ON v.vid = n.vid WHERE n.type = '%s'
+  ORDER BY v.weight, v.name", 'v', 'vid'), $form['type']['#value']);
+      //loop through vocabularies, moving their form element out of the taxonomy fieldset
+      while ($vocabulary = db_fetch_object($vocabularies)) {
+      //check to see if non-tag vocabularies exist 
+      if ($form['taxonomy'][$vocabulary->vid]) {
+          $field = $form['taxonomy'][$vocabulary->vid];
+          unset($form['taxonomy'][$vocabulary->vid]);
+          $form["taxonomy_field_$vocabulary->vid"] = $field;
+        }
+        //check to see if tag vocabularies exist
+        if ($form['taxonomy']['tags'][$vocabulary->vid]) {
+          $field = $form['taxonomy']['tags'][$vocabulary->vid];
+          unset($form['taxonomy']['tags'][$vocabulary->vid]);
+          $form["taxonomy_field_tags_$vocabulary->vid"] = $field;
+        }
+        // Direct copy from content.module, for setting the weight of fields based on arrangement in admin/content/node-type/[content type]/fields
+        $type = content_types($form['type']['#value']);
+        foreach ($type['extra'] as $key => $value) {
+          if (isset($form[$key])) {
+            $form[$key]['#weight'] = $value['weight'];
+          }
         }
       }
+      //Removing now empty taxonomy fieldset
+      if (isset($form['taxonomy'])) {
+        unset($form['taxonomy']);
+      }
     }
-    //Removing now empty taxonomy fieldset
-    if (isset($form['taxonomy'])) {
-      unset($form['taxonomy']);
-    }
-    
   }
 }
 
