You are here

function farm_movement_entity_presave in farmOS 7

Implements hook_entity_presave().

File

modules/farm/farm_movement/farm_movement.module, line 199
Farm movement.

Code

function farm_movement_entity_presave($entity, $type) {

  // When a movement field collection entity is being saved, populate the
  // geometry field from the "move to" area reference field.
  if ($type == 'field_collection_item' && $entity->field_name == 'field_farm_movement') {
    farm_movement_populate_geometry($entity);
  }

  // If an activity log is being saved with movement information, auto-fill the
  // log title.
  if ($type == 'log' && $entity->type == 'farm_activity') {
    farm_movement_populate_name($entity);
  }
}