You are here

function location_node_form_alter in Location 6.3

Same name and namespace in other branches
  1. 5.3 location_node.module \location_node_form_alter()
  2. 7.4 location_node.module \location_node_form_alter()

Implementation of hook_form_alter().

File

./location_node.module, line 11
Associate locations with nodes.

Code

function location_node_form_alter(&$form, &$form_state, $form_id) {
  if (isset($form['type']['#value']) && $form['type']['#value'] . '_node_form' == $form_id) {

    // Add the Location fields on the Node edit form
    $node = $form['#node'];
    $settings = variable_get('location_settings_node_' . $node->type, array());
    if (isset($settings['multiple']['max']) && $settings['multiple']['max'] > 0) {
      $locations = isset($node->locations) ? $node->locations : array();
      $form['locations'] = location_form($settings, $locations);
    }
  }
}