You are here

function location_empty_location in Location 5.3

Same name and namespace in other branches
  1. 6.3 location.module \location_empty_location()
  2. 7.5 location.module \location_empty_location()
  3. 7.3 location.module \location_empty_location()
  4. 7.4 location.module \location_empty_location()

Returns an empty location object based on the given settings.

3 calls to location_empty_location()
location_is_empty in ./location.module
Checks if a location is empty, and sets up an array of filled fields.
location_save in ./location.module
Save a location.
_location_expand_location in ./location.module
Process a location element.

File

./location.module, line 1185
Location module main routines. An implementation of a universal API for location manipulation. Provides functions for postal_code proximity searching, deep-linking into online mapping services. Currently, some options are configured through an…

Code

function location_empty_location($settings) {
  $location = array();
  $defaults = location_invoke_locationapi($location, 'defaults');
  if (isset($settings['form']['fields'])) {
    foreach ($settings['form']['fields'] as $k => $v) {
      if (isset($defaults[$k])) {
        $defaults[$k] = array_merge($defaults[$k], $v);
      }
    }
  }
  foreach ($defaults as $k => $v) {
    if (isset($v['default'])) {
      $location[$k] = $v['default'];
    }
  }
  return $location;
}