You are here

function theme_location_cck_formatter_multiple_all in Location 6.3

Return both a addresses and a single map with all location items.

File

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

Code

function theme_location_cck_formatter_multiple_all($element) {
  $content = '';
  $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();
  $locations = array();
  foreach (element_children($element) as $key) {
    $location = $element[$key]['#item'];
    $locations[$key] = $location;
    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)) {
        $content .= 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.
        $content .= theme('location', $location, $hide);
      }
    }
  }
  $content .= theme_location_cck_field_map($locations, $field);
  return $content;
}