You are here

function location_cck_field in Location 7.3

Same name and namespace in other branches
  1. 5.3 contrib/location_cck/location_cck.module \location_cck_field()
  2. 6.3 contrib/location_cck/location_cck.module \location_cck_field()
  3. 7.5 contrib/location_cck/location_cck.module \location_cck_field()
  4. 7.4 contrib/location_cck/location_cck.module \location_cck_field()

Implements hook_field().

File

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

Code

function location_cck_field($op, &$node, $field, &$items, $teaser, $page) {
  switch ($op) {
    case 'sanitize':

      // Get the location information for the lid if it hasn't already been
      // loaded (in the hook_field() load $op using location_load_location()).
      // This is necessary for Views and any other modules that use the
      // content_format() function to render CCK fields because content_format()
      // doesn't call the "load" $op.
      foreach ($items as $delta => $item) {
        if (!isset($item['latitude'])) {
          $items[$delta] = array_merge($items[$delta], location_load_location($item['lid']));
        }
      }
      break;
  }
}