You are here

function getlocations_location_taxonomize_element_submitted in Get Locations 7

Same name and namespace in other branches
  1. 7.2 modules/getlocations_location_taxonomize/getlocations_location_taxonomize.module \getlocations_location_taxonomize_element_submitted()

A submit handler for forms that contain an getlocations_fields widget

1 string reference to 'getlocations_location_taxonomize_element_submitted'
getlocations_location_taxonomize_process_address in modules/getlocations_location_taxonomize/getlocations_location_taxonomize.module
A #process callback function for the getlocations_fields widget Here we make note of this field in the form_state array, and add a submit callback to the form that will handle the processing.

File

modules/getlocations_location_taxonomize/getlocations_location_taxonomize.module, line 114
getlocations_location_taxonomize.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_location_taxonomize_element_submitted($form, &$form_state) {
  $lang = 'und';

  // Act on values
  $fields = $form_state['temporary']['getlocations_fields'];
  $items = array();
  foreach ($fields as $field) {
    $deltas = $form_state['values'][$field][$lang];
    foreach ($deltas as $delta) {

      // Add the country name
      $delta = getlocations_location_taxonomize_fixup($delta);
      $items[] = $delta;
    }
  }

  // taxonomize
  if (!empty($items)) {
    location_taxonomize_taxonomize($items, $form, $form_state);
  }
}