diff --git README.txt README.txt
index 08e0a5a..7e0b95a 100644
--- README.txt
+++ README.txt
@@ -8,7 +8,7 @@ available to drupal, including other fields, the current user, database
 tables, etc. The drawback of this is of course that you need to know some php
 to use it.
 
-Computed Field requires the content module (cck).
+Computed Field requires the field module.
 
 -------------------------Update-------------------------------
 
@@ -22,11 +22,11 @@ $node_field_item['value'];'
 
 ----------Getting Started-----------------------------------
 
-Before you can use Computed Field, you'll need to get CCK and enable (at the
-very least) the 'content' module. You will probably also want to enable the
-other cck modules, such as 'text', 'number', 'date', etc.
+Before you can use Computed Field, you'll enable the field module.
+You will probably also want to enable the
+other field modules, such as 'text', 'number', 'date', etc.
 
-To add a computed field to a content type, go to administer > content >
+To add a computed field to a content type, go to administer > structure >
 content types, select the content type you want to add to, and click on the
 'add field' tab. One of the field types available should be 'Computed', and it
 should have one bullet point under it, also labelled 'Computed'. If you select
diff --git computed_field.info computed_field.info
index 06ed6c8..835b1a5 100644
--- computed_field.info
+++ computed_field.info
@@ -1,7 +1,9 @@
 ; $Id$
 name = Computed Field
 description = Allows the user to define computed values in custom content types.
-core = 6.x
-dependencies[] = content
-package = CCK
+core = 7.x
+dependencies[] = field
+package = Field
+files[]=computed_field.install
+files[]=computed_field.module
 
diff --git computed_field.install computed_field.install
index dcd85ba..13bb990 100755
--- computed_field.install
+++ computed_field.install
@@ -1,34 +1,2 @@
 <?php
 // $Id$
-
-/**
-* Implementation of hook_install().
-*/
-function computed_field_install() {
-  drupal_load('module', 'content');
-  content_notify('install', 'computed_field');
-}
-
-/**
-* Implementation of hook_uninstall().
-*/
-function computed_field_uninstall() {
-  drupal_load('module', 'content');
-  content_notify('uninstall', 'computed_field');
-}
-
-/**
-* Implementation of hook_enable().
-*/
-function computed_field_enable() {
-  drupal_load('module', 'content');
-  content_notify('enable', 'computed_field');
-}
-
-/**
-* Implementation of hook_disable().
-*/
-function computed_field_disable() {
-  drupal_load('module', 'content');
-  content_notify('disable', 'computed_field');
-}
\ No newline at end of file
diff --git computed_field.module computed_field.module
index bf7495c..fff3b11 100644
--- computed_field.module
+++ computed_field.module
@@ -2,218 +2,259 @@
 // $Id$
 
 /**
- * Implementation of cck hook_field_info()
+ * Implements field hook_field_info().
  */
 function computed_field_field_info() {
   return array(
     'computed' => array(
       'label' => t('Computed'),
       'description' => t('Create field data via PHP code.'),
-      'callbacks' => array(
-        'tables' => CONTENT_CALLBACK_DEFAULT,
-        'arguments' => CONTENT_CALLBACK_DEFAULT,
-        ),
+      'settings' => array(
+        'code' => '$entity_field[0][\'value\'] = "";',
+        'display_format' => '$display = $entity_field_item[\'value\'];',
+        'store' => 1,
+        'data_type' => 'varchar',
+        'data_length' => NULL,
+        'data_not_NULL' => FALSE,
+        'data_default' => NULL,
+        'data_sortable' => TRUE
       ),
-    );
+      'default_widget' => 'computed',
+      'default_formatter' => 'default',
+    ),
+  );
 }
 
 /**
- * Implementation of cck hook_field_settings()
+ * Implements of hook_field_settings_form().
  */
-function computed_field_field_settings($op, $field) {
-  switch ($op) {
-    case 'form':
-      $form = array();
-      $compute_func = 'computed_field_'. $field['field_name'] .'_compute';
-      $display_func = 'computed_field_'. $field['field_name'] .'_display';
-      // these next 3 have been moved from widget to field, so they copy default values from widget
-      $form['code'] = array(
-        '#type' => 'textarea',
-        '#rows' => 15,
-        '#title' => t('Computed Code'),
-        '#description' => t('The variables available to your code are: ') .'<code>&amp;$node, $field, and &amp;$node_field</code>'. t('. To set the value of the field, set ') .'<code>$node_field[0][\'value\']</code>'. t('. Here\'s a simple example which sets the computed field\'s value to the value of the sum of the number fields field_a and field_b: ') .'<code>$node_field[0][\'value\'] = $node->field_a[0][\'value\'] + $node->field_b[0][\'value\'];</code>. '. t('Alternately, this code can be supplied by your own custom function named @compute_func().', array('@compute_func' => $compute_func)),
-        '#default_value' => !empty($field['code']) ? $field['code'] : '$node_field[0][\'value\'] = "";',
-        '#access' => !function_exists($compute_func),
+function computed_field_field_settings_form($field, $instance, $has_data) {
+  $form = array();
+  $compute_func = 'computed_field_'. $field['field_name'] .'_compute';
+  $display_func = 'computed_field_'. $field['field_name'] .'_display';
+  $settings = $field['settings'];
+  // these next 3 have been moved from widget to field, so they copy default values from widget
+  $form['code'] = array(
+    '#type' => 'textarea',
+    '#rows' => 15,
+    '#title' => t('Computed Code'),
+    '#description' => t('The variables available to your code are: ') .'<code>&amp;$node, $field, and &amp;$entity_field</code>'. t('. To set the value of the field, set ') .'<code>$entity_field[0][\'value\']</code>'. t('. Here\'s a simple example which sets the computed field\'s value to the value of the sum of the number fields field_a and field_b: ') .'<code>$entity_field[0][\'value\'] = $node->field_a[0][\'value\'] + $node->field_b[0][\'value\'];</code>. '. t('Alternately, this code can be supplied by your own custom function named @compute_func().', array('@compute_func' => $compute_func)),
+    '#default_value' => !empty($settings['code']) ? $settings['code'] : '$entity_field[0][\'value\'] = "";',
+    '#access' => !function_exists($compute_func),
+  );
+  if (function_exists($compute_func)) {
+    $form['compute_func'] = array(
+    '#type' => 'item',
+    '#value' => t('This field is computed using @compute_func().', array('@compute_func' => $compute_func)),
+    );
+  }
+  $form['display_format'] = array(
+    '#type' => 'textarea',
+    '#title' => t('Display Format'),
+    '#description' => t('This code should assign a string to the $display variable, which will be printed as the value of the field. The stored value of the field is in $entity_field_item[\'value\'].  Note: this code has no effect if you use the "Computed Value" formatter option. Alternately, this code can be supplied by your own custom function named @display_func().', array('@display_func' => $display_func)) ,
+    '#default_value' => !empty($settings['display_format']) ? $settings['display_format'] : '$display = $entity_field_item[\'value\'];',
+    '#access' => !function_exists($display_func),
+  );
+  if (function_exists($display_func)) {
+    $form['display_func'] = array(
+      '#type' => 'item',
+      '#value' => t('This field is computed using @display_func().', array('@display_func' => $display_func)),
       );
-      if (function_exists($compute_func)) {
-        $form['compute_func'] = array(
-        '#type' => 'item',
-        '#value' => t('This field is computed using @compute_func().', array('@compute_func' => $compute_func)),
-        );
+  }
+  $form['store'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Store using the database settings below'),
+    '#default_value' => is_numeric($settings['store']) ? $settings['store'] : 1 ,
+  );
+  $form['database'] = array('#type' => 'fieldset', '#title' => t('Database Storage Settings'));
+  $form['database']['data_type'] = array(
+    '#type' => 'radios',
+    '#title' => t('Data Type'),
+    '#description' => t('The SQL datatype to store this field in.'),
+    '#default_value' => !empty($settings['data_type']) ? $settings['data_type'] : 'varchar',
+    '#options' => array('int' => 'int', 'float' => 'float', 'varchar' => 'varchar', 'text' => 'text', 'longtext' => 'longtext'),
+    '#required' => FALSE,
+  );
+  $form['database']['data_length'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Data Length'),
+    '#default_value' => !empty($settings['data_length']) ? $settings['data_length'] : NULL,
+    '#required' => FALSE,
+  );
+  $form['database']['data_default'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Default Value'),
+    '#default_value' => $settings['data_default'],
+    '#required' => FALSE,
+  );
+  $form['database']['data_not_NULL'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Not NULL'),
+    '#default_value' => is_numeric($settings['data_not_NULL']) ? $settings['data_not_NULL'] : FALSE,
+  );
+  $form['database']['data_sortable'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Sortable'),
+    '#default_value' => is_numeric($settings['data_sortable']) ? $settings['data_sortable'] : TRUE,
+  );
+  return $form;
+}
+
+/**
+ * Implements of hook_field_settings_validate().
+ */
+  function computed_field_field_settings_validate($field, $instance, $has_data) {
+  $settings = $field['settings'];
+  if ($settings['store']) {
+    if (empty($settings['data_type'])) {
+      form_set_error('data_type', t('To store this field in the database, please specify a data type.'));
+    }
+    if (!($settings['data_type'] == 'text' || $settings['data_type'] == 'longtext') && empty($settings['data_length'])) {
+      form_set_error('data_length', t('To store this field in the database, please specify the data length.'));
+    }
+  }
+}
+
+/**
+ * Implements of hook_field_schema().
+ */
+function computed_field_field_schema($field) {
+  if ($field['type'] == 'computed') {
+    $settings = $field['settings'];
+    if ($settings['store']) {
+      $columns = array('value' => array());
+      if ($settings['data_type'] == 'longtext') {
+        $columns['value']['type'] = 'text';
+        $columns['value']['size'] = 'big';
       }
-      $form['display_format'] = array(
-        '#type' => 'textarea',
-        '#title' => t('Display Format'),
-        '#description' => t('This code should assign a string to the $display variable, which will be printed as the value of the field. The stored value of the field is in $node_field_item[\'value\'].  Note: this code has no effect if you use the "Computed Value" formatter option. Alternately, this code can be supplied by your own custom function named @display_func().', array('@display_func' => $display_func)) ,
-        '#default_value' => !empty($field['display_format']) ? $field['display_format'] : '$display = $node_field_item[\'value\'];',
-        '#access' => !function_exists($display_func),
-      );
-      if (function_exists($display_func)) {
-        $form['display_func'] = array(
-          '#type' => 'item',
-          '#value' => t('This field is computed using @display_func().', array('@display_func' => $display_func)),
-          );
+      else {
+        $columns['value']['type'] = isset($settings['data_type']) ? $settings['data_type'] : 'varchar';
       }
-      $form['store'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Store using the database settings below'),
-        '#default_value' => is_numeric($field['store']) ? $field['store'] : 1 ,
-      );
-      $form['database'] = array('#type' => 'fieldset', '#title' => t('Database Storage Settings'));
-      $form['database']['data_type'] = array(
-        '#type' => 'radios',
-        '#title' => t('Data Type'),
-        '#description' => t('The SQL datatype to store this field in.'),
-        '#default_value' => !empty($field['data_type']) ? $field['data_type'] : 'varchar',
-        '#options' => array('int' => 'int', 'float' => 'float', 'varchar' => 'varchar', 'text' => 'text', 'longtext' => 'longtext'),
-        '#required' => FALSE,
-      );
-      $form['database']['data_length'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Data Length'),
-        '#default_value' => !empty($field['data_length']) ? $field['data_length'] : NULL,
-        '#required' => FALSE,
-      );
-      $form['database']['data_default'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Default Value'),
-        '#default_value' => $field['data_default'],
-        '#required' => FALSE,
-      );
-      $form['database']['data_not_NULL'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Not NULL'),
-        '#default_value' => is_numeric($field['data_not_NULL']) ? $field['data_not_NULL'] : FALSE,
-      );
-      $form['database']['data_sortable'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Sortable'),
-        '#default_value' => is_numeric($field['data_sortable']) ? $field['data_sortable'] : TRUE,
-      );
-      return $form;
-    case 'validate':
-      if ($field['store']) {
-        if (empty($field['data_type'])) {
-          form_set_error('data_type', t('To store this field in the database, please specify a data type.'));
-        }
-        if (!($field['data_type'] == 'text' || $field['data_type'] == 'longtext') && empty($field['data_length'])) {
-          form_set_error('data_length', t('To store this field in the database, please specify the data length.'));
-        }
+      // text and longtext should not have a length, so we ignore it
+      if (!($settings['data_type'] == 'text' || $settings['data_type'] == 'longtext')) {
+        $columns['value']['length'] = isset($settings['data_length']) ? $settings['data_length'] : 32;
       }
-      break;
-    case 'save':
-      return array('code', 'display_format', 'store', 'data_type', 'data_length', 'data_not_NULL', 'data_default', 'data_sortable');
-    case 'database columns':
-      if ($field['store']) {
-        $columns = array('value' => array());
-        if ($field['data_type'] == 'longtext') {
-          $columns['value']['type'] = 'text';
-          $columns['value']['size'] = 'big';
-        }
-        else {
-          $columns['value']['type'] = isset($field['data_type']) ? $field['data_type'] : 'varchar';
-        }
-        // text and longtext should not have a length, so we ignore it
-        if (!($field['data_type'] == 'text' || $field['data_type'] == 'longtext')) {
-          $columns['value']['length'] = isset($field['data_length']) ? $field['data_length'] : 32;
-        }
-        $columns['value']['not NULL'] = isset($field['data_not_NULL']) ? $field['data_not_NULL'] : TRUE;
-        $columns['value']['sortable'] = isset($field['data_sortable']) ? $field['data_sortable'] : FALSE;
-        if ($field['data_default'] != '')  {
-          $columns['value']['default'] = $field['data_default'];
-        }
+      $columns['value']['not NULL'] = isset($settings['data_not_NULL']) ? $settings['data_not_NULL'] : TRUE;
+      $columns['value']['sortable'] = isset($settings['data_sortable']) ? $settings['data_sortable'] : FALSE;
+      if ($settings['data_default'] != '')  {
+        $columns['value']['default'] = $settings['data_default'];
       }
-      return $columns;
+    }
+  }
+  return array(
+    'columns' => $columns,
+  );
+}
 
-    case 'filters':
-      return array(
-        'default' => array(
-          'name' => t('Default'),
-          'operator' => 'views_handler_operator_gtlt',
-        ),
-      );
-    case 'callbacks':
-      return array(
-        'view' => CONTENT_CALLBACK_CUSTOM,
-      );
-    case 'views data':
-      $allowed_values = content_allowed_values($field);
-      if (count($allowed_values)) {
-        $data = content_views_field_views_data($field);
-        $db_info = content_database_info($field);
-        $table_alias = content_views_tablename($field);
+/**
+ * Implements of hook_field_settings_filters().
+ */
+function computed_field_field_settings_filters($field) {
+  return array(
+    'default' => array(
+      'name' => t('Default'),
+      'operator' => 'views_handler_operator_gtlt',
+    ),
+  );
+}
 
-        // Swap the filter handler to the 'in' operator.
-        $data[$table_alias][$field['field_name'] .'_value']['filter']['handler'] = 'content_handler_filter_many_to_one';
-        return $data;
-      }
+/**
+ * Implements of hook_field_settings_callbacks().
+ */
+function computed_field_field_settings_callbacks($field) {
+  return array(
+    'view' => FIELD_BEHAVIOR_CUSTOM,
+  );
+}
+
+/**
+ * Implements of hook_field_settings_views_data().
+ */
+function computed_field_field_settings_views_data($field) {
+  $allowed_values = content_allowed_values($field);
+  if (count($allowed_values)) {
+    $table_alias = _field_sql_storage_tablename($field);
+
+    // Swap the filter handler to the 'in' operator.
+    // @TODO Wait for fieldapi integration into views to implement this.
+    $data[$table_alias][$field['field_name'] .'_value']['filter']['handler'] = 'content_handler_filter_many_to_one';
+    return $data;
   }
 }
 
-function _computed_field_compute_value(&$node, $field, &$node_field) {
+function _computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, &$items, &$errors) {
+  $settings = $field['settings'];
+  $entity_field =& $items;
   // Allow the value to be computed from code not stored in DB
   $compute_func = 'computed_field_'. $field['field_name'] .'_compute';
   if (function_exists($compute_func)) {
-    $compute_func($node, $field, $node_field);
+    $compute_func($entity_field, $entity_type, $entity, $field, $instance, $langcode, $items, &$errors);
   }
   else {
-    if (isset($field['code'])) {
-      eval($field['code']);
+    if (isset($settings['code'])) {
+      eval($settings['code']);
     }
   }
+  $entity->$field['field_name'][$langcode] = $items;
 }
 
 /**
- * Implementation of cck hook_field()
+ * Implements field hook_field_load().
  */
-function computed_field_field($op, &$node, $field, &$node_field, $teaser, $page) {
-  switch ($op) {
-    case 'load':
-      // compute field on load if it isn't stored in the database
-      if (!$field['store']) {
-        _computed_field_compute_value($node, $field, $node_field);
-        return array($field['field_name'] => $node_field);
-      }
-      break;
-    case 'sanitize':
-      // compute field for node previews
-      if ($node->build_mode == NODE_BUILD_PREVIEW) {
-        _computed_field_compute_value($node, $field, $node_field);
-      }
-      break;
-    case 'view':
-      $items = array();
-      foreach ($node_field as $delta => $item) {
-        $items[$delta]['view'] = content_format($field, $item, 'default', $node);
-      }
-      return theme('field', $node, $field, $items, $teaser, $page);
-      break;
-    case 'validate':
-      break;
-    case 'insert':
-    case 'update':
-      _computed_field_compute_value($node, $field, $node_field);
-      break;
+function computed_field_field_load($entity_type, $entity, $field, $instance, $langcode, &$items, &$errors) {
+  $settings = $field['settings'];
+  // compute field on load if it isn't stored in the database
+  if (!$settings['store']) {
+    _computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, $items, &$errors);
+    return array($field['field_name'] => $entity_field);
   }
 }
 
 /**
- * Implementation of cck hook_widget_info()
+ * Implements field hook_field_view().
  */
-function computed_field_widget_info() {
+function computed_field_field_view($entity_type, $entity, $field, $instance, $langcode, &$items, &$errors) {
+  $items = array();
+  foreach ($entity_field as $delta => $item) {
+    $items[$delta]['view'] = content_format($field, $item, 'default', $node);
+  }
+  return theme('field', $node, $field, $items, $teaser, $page);
+}
+
+/**
+ * Implements field hook_field_insert().
+ */
+function computed_field_field_insert($entity_type, $entity, $field, $instance, $langcode, &$items, &$errors) {
+  _computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, $items, &$errors);
+}
+
+/**
+ * Implements field hook_field_update().
+ */
+function computed_field_field_update($entity_type, $entity, $field, $instance, $langcode, &$items, &$errors) {
+  _computed_field_compute_value($entity_type, $entity, $field, $instance, $langcode, $items, &$errors);
+}
+
+/**
+ * Implements field hook_field_widget_info().
+ */
+function computed_field_field_widget_info() {
   return array(
     'computed' => array(
       'label' => t('Computed'),
       'field types' => array('computed'),
-      'multiple values' => CONTENT_HANDLE_MODULE,
+      'behaviors' => array(
+        'multiple values' => FIELD_BEHAVIOR_DEFAULT,
+        'default value' => FIELD_BEHAVIOR_DEFAULT,
+      ),
     ),
   );
 }
 
 /**
- * Implementation of cck hook_widget()
+ * Implements field hook_field_widget_form().
  */
-function computed_field_widget(&$form, &$form_state, $field, $items, $delta = 0) {
+function computed_field_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
   $elements = array();
   foreach($items as $delta => $item) {
     $elements[$delta]['value'] = array (
@@ -226,18 +267,7 @@ function computed_field_widget(&$form, &$form_state, $field, $items, $delta = 0)
 }
 
 /**
- * Implementation of cck hook_view_item (obsolete, retained for backward compatibility with older cck)
- */
-function computed_field_view_item($field, $node_field_item, $node = NULL) {
-  global $base_url;
-
-  $display = '';
-  eval($field['display_format']);
-  return $display;
-}
-
-/**
- * Implementation of hook_theme()
+ * Implements hook_theme().
  */
 function computed_field_theme() {
   return array(
@@ -257,7 +287,7 @@ function computed_field_theme() {
 }
 
 /**
- * Implementation of cck hook_field_formatter_info()
+ * Implements hook_field_formatter_info().
  */
 function computed_field_field_formatter_info() {
   return array(
@@ -284,9 +314,9 @@ function computed_field_field_formatter_info() {
  * Theme function for 'default' text field formatter.
  */
 function theme_computed_field_formatter_default($element) {
-  $field = content_fields($element['#field_name']);
+  $field = field_info_fields($element['#field_name']);
   // For "some" backwards compatibility
-  $node_field_item['value'] = $element['#item']['value'];
+  $entity_field_item['value'] = $element['#item']['value'];
 
   // Allow the value to be formated from code not stored in DB
   $display_func = 'computed_field_'. $field['field_name'] .'_display';
@@ -303,9 +333,9 @@ function theme_computed_field_formatter_default($element) {
  * Theme function for 'plain' text field formatter.
  */
 function theme_computed_field_formatter_plain($element) {
-  $field = content_fields($element['#field_name']);
+  $field = field_info_fields($element['#field_name']);
   // For "some" backwards compatibility
-  $node_field_item['value'] = $element['#item']['value'];
+  $entity_field_item['value'] = $element['#item']['value'];
 
   // Allow the value to be formated from code not stored in DB
   $display_func = 'computed_field_'. $field['field_name'] .'_display';
@@ -322,9 +352,9 @@ function theme_computed_field_formatter_plain($element) {
  * Theme function for 'markup' text field formatter.
  */
 function theme_computed_field_formatter_markup($element) {
-  $field = content_fields($element['#field_name']);
+  $field = field_info_fields($element['#field_name']);
   // For "some" backwards compatibility
-  $node_field_item['value'] = $element['#item']['value'];
+  $entity_field_item['value'] = $element['#item']['value'];
 
   // Allow the value to be formated from code not stored in DB
   $display_func = 'computed_field_'. $field['field_name'] .'_display';
@@ -345,14 +375,14 @@ function theme_computed_field_formatter_computed_value($element) {
 }
 
 /**
- * Implementation of cck hook_content_is_empty().
+ * Implements field hook_field_is_empty().
  */
-function computed_field_content_is_empty() {
+function computed_field_field_is_empty() {
   return FALSE;
 }
 
 /**
- * Implementation of hook_token_list()
+ * Implements hook_token_list().
  */
 function computed_field_token_list($type = 'all') {
   if ($type == 'field' || $type == 'all') {
@@ -366,7 +396,7 @@ function computed_field_token_list($type = 'all') {
 }
 
 /**
- * Implementation of hook_token_values()
+ * Implements hook_token_values().
  */
 function computed_field_token_values($type, $object = NULL, $options = array()) {
   if ($type == 'field') {
