You are here

function location_addanother_form_submit in Location 7.3

Same name and namespace in other branches
  1. 5.3 contrib/location_addanother/location_addanother.module \location_addanother_form_submit()
  2. 6.3 contrib/location_addanother/location_addanother.module \location_addanother_form_submit()
  3. 7.5 contrib/location_addanother/location_addanother.module \location_addanother_form_submit()
  4. 7.4 contrib/location_addanother/location_addanother.module \location_addanother_form_submit()

Submission function for "add another location" form.

File

contrib/location_addanother/location_addanother.module, line 114
"Add location from node view" functionality. Split from main location.module in version 3.

Code

function location_addanother_form_submit($form, &$form_state) {
  $location = $form_state['values']['location'];
  $node = node_load($location['nid']);
  $locations = $node->locations;
  unset($location['nid']);
  $locations[] = $location;
  location_save_locations($locations, array(
    'nid' => $node->nid,
    'vid' => $node->vid,
  ));
  return 'node/' . $node->nid;
}