You are here

function location_is_empty in Location 7.4

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

Checks if a location is empty, and sets up an array of filled fields.

Parameters

$location The location to check.:

$filled An array (Will contain the list of filled fields upon return.):

Return value

TRUE if the location is empty, FALSE otherwise.

4 calls to location_is_empty()
location_cck_field_is_empty in contrib/location_cck/location_cck.module
CCK Emptiness check.
location_save in ./location.module
Save a location.
theme_location_cck_formatter_all in contrib/location_cck/location_cck.module
Return both an address and a map for an individual item.
theme_location_cck_formatter_default in contrib/location_cck/location_cck.module
Return an address for an individual item.

File

./location.module, line 1289
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_is_empty($location, &$filled) {

  // Special case: Consider an empty array to be empty.
  if (empty($location)) {
    return TRUE;
  }

  // Special case: Consider a location with the "delete" checkbox checked to
  // be empty.
  if (isset($location['delete_location']) && $location['delete_location']) {
    return TRUE;
  }

  // Patch locpick at this point.
  // Otherwise, changing locpick only will not show a difference.
  _location_patch_locpick($location);
  $settings = isset($location['location_settings']) ? $location['location_settings'] : array();
  $emptyloc = location_empty_location($settings);
  return !location_calc_difference($emptyloc, $location, $filled);
}