You are here

function location_addanother_form_validate in Location 5.3

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

Validation function for "add another location" form.

File

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

Code

function location_addanother_form_validate($form_id, &$form_values) {
  $location = $form_values['location'];
  $node = node_load($location['nid']);
  unset($location['nid']);
  if (!(variable_get('location_addanother_' . $node->type, 0) && count($node->locations) < variable_get('location_maxnum_' . $node->type, 0) && node_access('update', $node))) {
    form_set_error('location', t("You don't have permission to add a location to this node, or the node has the maximum number of locations already."));
  }
}