You are here

function location_node_settings_validate in Location 5

Same name and namespace in other branches
  1. 5.3 location_node.module \location_node_settings_validate()
  2. 6.3 location_node.module \location_node_settings_validate()
  3. 7.3 location_node.module \location_node_settings_validate()
  4. 7.4 location_node.module \location_node_settings_validate()

File

./location.module, line 765

Code

function location_node_settings_validate($form_id, $form_values) {
  $type = $form_values['type'];
  $maxnum_name = 'location_maxnum_' . $type;
  $defaultnum_name = 'location_defaultnum_' . $type;
  if ($form_values[$defaultnum_name] > $form_values[$maxnum_name]) {
    form_set_error($defaultnum_name, t("Your default number of location-forms that show up can't be greater than the maximum number of locations allowed for this node type."));
  }
  if (!$form_values[$defaultnum_name] && $form_values[$maxnum_name]) {
    form_set_error($defaultnum_name, t("You must have at least 1 default location-form enabled if you are going to allow locations to be submitted for nodes of this type.  If you don't intend to allow locations to be submitted for nodes of this type, set the maximum number of locations allowed for this type to 0."));
  }
}