You are here

function theme_location_cck_formatter_default in Location 6.3

Same name and namespace in other branches
  1. 7.4 contrib/location_cck/location_cck.module \theme_location_cck_formatter_default()

Return an address for an individual item.

File

contrib/location_cck/location_cck.module, line 322
Defines location field type.

Code

function theme_location_cck_formatter_default($element) {
  $field = content_fields($element['#field_name'], $element['#type_name']);
  $hide = isset($field['location_settings']['display']['hide']) ? array_keys(array_filter($field['location_settings']['display']['hide'])) : array();
  $location = $element['#item'];
  if (!empty($location['cck_preview_in_progress'])) {

    // Our canary field is in place, we are in a node preview.
    $fields = array();

    // If the location isn't "empty", then theme it based on the current state
    // of the item.
    if (!location_is_empty($location, $fields)) {
      return theme('location', $location, $hide);
    }
  }
  else {
    if (isset($location['lid']) && $location['lid']) {

      // "normal" viewing.
      // Location is already cached by CCK, so no need to load it.
      return theme('location', $location, $hide);
    }
  }
}