Index: relation.field.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/relation/relation.field.inc,v
retrieving revision 1.2
diff -u -p -r1.2 relation.field.inc
--- relation.field.inc	4 Dec 2010 12:59:42 -0000	1.2
+++ relation.field.inc	4 Dec 2010 22:50:24 -0000
@@ -44,14 +44,15 @@ function relation_field_presave($entity_
 
   $relations = array();
   foreach ($items as $item) {
+    // Create a new relation_id for new relations.
     if (!isset($item['relation_id'])) {
       $item['relation_id'] = db_next_id();
     }
-    $relations[$item['entity_type']][$item['relation_id']] = $item['entity_id'];
+    $relations[$item['other_entity_type']][$item['relation_id']] = $item['other_entity_id'];
   }
 
-  foreach ($relations as $target_type => $source_relations) {
-    $targets = entity_load($target_type, $source_relations);
+  foreach ($relations as $target_type => $entity_relations) {
+    $targets = entity_load($target_type, $entity_relations);
     // @todo The else condition must not happen; implement hook_field_validate().
     if (!$targets) {
       continue;
@@ -73,15 +74,15 @@ function relation_field_presave($entity_
         );
       }
       // Add a new relation, if it does not exist yet.
-      foreach ($source_relations as $relation_id => $target_entity_id) {
+      foreach ($entity_relations as $relation_id => $target_entity_id) {
         if (!isset($target_relations[$relation_id])) {
           $target_items[] = array(
             'relation_id' => $relation_id,
-            'entity_type' => $entity_type,
-            'entity_id' => $id,
+            'other_entity_type' => $entity_type,
+            'other_entity_id' => $id,
             // @todo Add optional revision_id handling.
-            // 'revision_id' => $vid,
-            'revision_id' => NULL,
+            // 'other_revision_id' => $vid,
+            'other_revision_id' => NULL,
           );
         }
       }
@@ -146,27 +147,27 @@ function relation_field_widget_info() {
 function relation_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
   if (!isset($items[$delta])) {
     $items[$delta] = array(
-      'entity_type' => '',
-      'entity_id' => '',
       'relation_id' => NULL,
+      'other_entity_type' => '',
+      'other_entity_id' => '',
     );
   }
 
   $element['#type'] = 'fieldset';
-  $element['entity_type'] = array(
+  $element['relation_id'] = array(
+    '#type' => 'value',
+    '#value' => $items[$delta]['relation_id'],
+  );
+  $element['other_entity_type'] = array(
     '#type' => 'select',
     '#title' => t('Entity type'),
     '#options' => drupal_map_assoc(array_keys($field['bundles'])),
-    '#default_value' => $items[$delta]['entity_type'],
+    '#default_value' => $items[$delta]['other_entity_type'],
   );
-  $element['entity_id'] = array(
+  $element['other_entity_id'] = array(
     '#title' => t('Entity ID'),
     '#type' => 'textfield',
-    '#default_value' => $items[$delta]['entity_id'],
-  );
-  $element['relation_id'] = array(
-    '#type' => 'value',
-    '#value' => $items[$delta]['relation_id'],
+    '#default_value' => $items[$delta]['other_entity_id'],
   );
   return $element;
 }
@@ -189,10 +190,10 @@ function relation_field_formatter_info()
 function relation_field_formatter_view($entity_type, $entity, $field, $instance, $langcode, $items, $display) {
   $links = array();
   foreach ($items as $item) {
-    $class = $item['entity_type'] . '-' . $item['entity_id'];
-    $uri = entity_uri($item['entity_type'], $item['entity']);
+    $class = $item['other_entity_type'] . '-' . $item['other_entity_id'];
+    $uri = entity_uri($item['other_entity_type'], $item['entity']);
     $links[$class] = array(
-      'title' => entity_label($item['entity_type'], $item['entity']),
+      'title' => entity_label($item['other_entity_type'], $item['entity']),
       'href' => $uri['path'],
     ) + $uri;
   }
@@ -212,8 +213,8 @@ function relation_field_formatter_prepar
   $entities_to_load = array();
   foreach ($items as $key => $item) {
     foreach ($item as $delta => $value) {
-      $entities_to_load[$value['entity_type']][] = $value['entity_id'];
-      $lookup[$value['entity_type']][$value['entity_id']][] = array($key, $delta);
+      $entities_to_load[$value['other_entity_type']][] = $value['other_entity_id'];
+      $lookup[$value['other_entity_type']][$value['other_entity_id']][] = array($key, $delta);
     }
   }
   foreach ($entities_to_load as $entity_type => $ids) {
Index: relation.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/relation/relation.install,v
retrieving revision 1.3
diff -u -p -r1.3 relation.install
--- relation.install	4 Dec 2010 12:59:42 -0000	1.3
+++ relation.install	4 Dec 2010 22:49:42 -0000
@@ -18,19 +18,19 @@ function relation_field_schema() {
         'not null' => TRUE,
         'default' => 0,
       ),
-      'entity_type' => array(
+      'other_entity_type' => array(
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'default' => '',
       ),
-      'entity_id' => array(
+      'other_entity_id' => array(
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => TRUE,
         'default' => 0,
       ),
-      'revision_id' => array(
+      'other_revision_id' => array(
         'type' => 'int',
         'unsigned' => TRUE,
         'not null' => FALSE,
@@ -38,7 +38,7 @@ function relation_field_schema() {
     ),
     'indexes' => array(
       'relation_id' => array('relation_id'),
-      'entity' => array('entity_type', 'entity_id'),
+      'other_entity' => array('other_entity_type', 'other_entity_id'),
     ),
   );
   return $schema;
