Index: location_node.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/location/location_node.module,v retrieving revision 1.1.2.2 diff -u -p -r1.1.2.2 location_node.module --- location_node.module 25 Feb 2009 18:49:31 -0000 1.1.2.2 +++ location_node.module 20 Oct 2009 17:07:33 -0000 @@ -10,6 +10,25 @@ * Implementation of hook_form_alter(). */ function location_node_form_alter(&$form, &$form_state, $form_id) { + if ($form_id == 'content_field_overview_form') { + $settings = variable_get('location_settings_node_'. $form['#type_name'], array()); + if (isset($settings['multiple']['max']) && $settings['multiple']['max'] > 0) { + $form['location'] = array( + 'label' => array('#value' => 'Location'), + 'description' => array('#value' => 'Location module form.'), + 'weight' => array('#type' => 'textfield', '#default_value' => $settings['display']['weight'], '#size' => 3), + 'parent' => array('#type' => 'hidden', '#default_value' => ''), + 'hidden_name' => array('#type' => 'hidden', '#default_value' => 'location'), + '#leaf' => TRUE, + '#root' => TRUE, + '#disabled_row' => TRUE, + '#row_type' => 'extra', + ); + $form['#extra'][] = 'location'; + $form['#field_rows'][] = 'location'; + $form['#submit'][] = 'location_node_content_field_order_submit'; + } + } if (isset($form['type']['#value']) && $form['type']['#value'] .'_node_form' == $form_id) { // Add the Location fields on the Node edit form $node = $form['#node']; @@ -21,6 +40,15 @@ function location_node_form_alter(&$form } } +/* +* Custom submit handler to save the order of the location field from the content mangage fields screen. +*/ +function location_node_content_field_order_submit($form, &$form_state) { + $settings = variable_get('location_settings_node_'. $form['#type_name'], array()); + $settings['form']['weight'] = $settings['display']['weight'] = $form_state['values']['location'] = $form_state['values']['location']['weight']; + variable_set('location_settings_node_'. $form['#type_name'], $settings); +} + /** * Implementation of hook_nodeapi(). */