diff --git a/required_for_pub.info b/required_for_pub.info
index fabbd68..f831ed3 100644
--- a/required_for_pub.info
+++ b/required_for_pub.info
@@ -1,5 +1,12 @@
 name = Required for Publishing
 description = Allows forms to be filled without required fields before publishing.
-dependencies[] = content
-package = Validation
-core = 6.x
+;dependencies[] = field
+core = 7.x
+;configure = admin/config/content/validation
+
+; Information added by drupal.org packaging script on 2011-03-11
+version = "7.x-dev"
+core = "7.x"
+project = "required_for_pub"
+datestamp = "1299872168"
+
diff --git a/required_for_pub.install b/required_for_pub.install
index 6acf572..fff55c3 100644
--- a/required_for_pub.install
+++ b/required_for_pub.install
@@ -1,17 +1,31 @@
 <?php
 
 /**
- * Implementation of hook_install().
+ * @file
+ * Installs the required_for_pub module.
+ *
+ * Creates a database for use of multi-layered default formats and sets
+ * default settings.
+ */
+
+/**
+ * Implements of hook_install().
  */
 function required_for_pub_install() {
   // Set to a higher weight to allow values to be set by other modules before validation
-  db_query("UPDATE {system} SET weight = 1 WHERE name = 'required_for_pub'");
+  db_update('system')
+    ->fields(array('weight' => 1))
+    ->condition('type', 'module')
+    ->condition('name', 'required_for_pub')
+    ->execute();
 }
 
 /**
- * Implementation of hook_update_N().
+ * Implements of hook_uninstall().
  */
-function required_for_pub_update_6100() {
-  // Set to a higher weight to allow values to be set by other modules before validation
-  db_query("UPDATE {system} SET weight = 1 WHERE name = 'required_for_pub'");
+function required_for_pub_uninstall() {
+  // Delete settings form varible table.
+  db_delete('variable')
+    ->condition('name', 'required_for_pub')
+    ->execute();
 }
diff --git a/required_for_pub.module b/required_for_pub.module
index 4d04c0d..44797a1 100644
--- a/required_for_pub.module
+++ b/required_for_pub.module
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * Implementation of hook_help().
+ * Implements of hook_help().
  */
 function required_for_pub_help($path, $arg) {
   switch ($path) {
@@ -11,47 +11,53 @@ function required_for_pub_help($path, $arg) {
 }
 
 /**
- * Implementation of hook_field_settings_alter().
+ * Implements of hook_field_info_alter(&$info).
  */
-function required_for_pub_field_settings_alter(&$form, $op, $field) {
-  switch ($op) {
-    case 'form':
-      $form['required_for_pub'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Required for publishing'),
-        '#description' => t('Allows the form to be saved in unpublished state without entering the required fields.'),
-        '#default_value' => isset($field['required_for_pub']) ? $field['required_for_pub'] : 0,
-        '#element_validate' => array('_required_for_pub_field_settings_validate'),
-        '#weight' => 0,
-      );
-      break;
-    case 'save':
-      $form = array_merge($form, array('required_for_pub'));
-      break;
+function required_for_pub_field_info_alter(&$info) {
+  // Add a setting to all field types.
+  foreach ($info as $field_type => &$field_type_info) {
+  $field_type_info += array('instance_settings' => array());
+	$field_type_info['instance_settings'] += array(
+      'required_for_pub' => FALSE,
+    );
   }
 }
 
 /**
- * Make sure both the required and required_for_pub checkboxes are not checked simultaneously.`
+ * Implements of hook_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id).
+ */
+function required_for_pub_form_field_ui_field_edit_form_alter(&$form, &$form_state, $form_id) {
+  $form['instance']['required_for_pub'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Required for publishing'),
+    '#description' => t('Allows the form to be saved in unpublished state without entering the required fields.'),
+    '#default_value' => isset($form['#instance']['required_for_pub']) ? $form['#instance']['required_for_pub'] : FALSE,
+    '#element_validate' => array('_required_for_pub_field_settings_validate'),
+    '#weight' => -9,
+  );
+}
+
+/**
+ * Make sure both the required and required_for_pub checkboxes are not checked simultaneously.
  */
 function _required_for_pub_field_settings_validate($element, &$form_state) {
-  if ($form_state['values']['required'] == 1 && $form_state['values']['required_for_pub'] == 1) {
+  if ($form_state['values']['instance']['required'] == 1 && $form_state['values']['instance']['required_for_pub'] == 1) {
     form_set_error('required_for_pub', t('You cannot have a field be both required and required for publishing.'));
   }
 }
 
 /**
- * Implementation of hook_form_alter().
+ * Implements of hook_form_alter().
  */
 function required_for_pub_form_alter(&$form, &$form_state, $form_id) {
   // If node publishing is enabled, mark the checkbox regardless of the current status.
   if (isset($form['#node']) && array_search('status', variable_get('node_options_' . $form['#node']->type, array())) !== FALSE) {
-    $fields = $form['#field_info'];
+    $fields = $form_state['field'];
     // Verify that there are fields in the content type.
     if (is_array($fields)) {
       foreach ($fields as $field) {
         // Make sure at least one field is set as required_for_pub
-        if ($field['required_for_pub']) {
+        if ($field['und']['instance']['required_for_pub']) {
           $form['options']['status']['#default_value'] = TRUE;
           return;
         }
@@ -61,33 +67,39 @@ function required_for_pub_form_alter(&$form, &$form_state, $form_id) {
 }
 
 /**
- * Implementation of hook_elements().
+ * Implements of hook_element_info().
  */
-function required_for_pub_elements() {
-  $widgets = _content_widget_types();
-  $elements = array();
-  foreach ($widgets as $widget => $value) {
-    $elements[$widget] = array(
-      '#process' => array('required_for_pub_element_process'),
-      '#element_validate' => array('required_for_pub_element_validate'),
-      '#post_render' => array('required_for_pub_element_required'),
-      '#required_for_pub' => FALSE,
-    );
-  }
-  return $elements;
+function required_for_pub_element_info() {
+  // ToDo: $element must be a field then pass to process.
+  // Because not every element has #field_name.
+  $types['textfield'] = array(
+    '#input' => TRUE,
+    '#process' => array('required_for_pub_element_process'),
+    '#element_validate' => array('required_for_pub_element_validate'),
+    '#post_render' => array('required_for_pub_element_required'),
+	  '#required_for_pub' => FALSE,
+  );
+  $types['textarea'] = array(
+    '#input' => TRUE,
+    '#process' => array('required_for_pub_element_process'),
+    '#element_validate' => array('required_for_pub_element_validate'),
+    '#post_render' => array('required_for_pub_element_required'),
+	  '#required_for_pub' => FALSE,
+  );
+  return $types;
 }
 
 /**
  * Form element process function to add required for publishing.
  */
-function required_for_pub_element_process($element, $edit, &$form_state, $form) {
-  // Do nothing if it's not a node editing form or if required_for_pub is not enabled in this field
-  if ($form['#id'] != 'node-form' || !$form['#field_info'][$element['#field_name']]['required_for_pub']) {
+function required_for_pub_element_process($element, &$form_state, $complete_form) {
+  // Do nothing if it's not a node editing form or it required_for_pub is not enabled in this field.
+  if (!isset($complete_form['#node_edit_form']) || !isset($form_state['field'][$element['#parents'][0]]['und']['instance']['required_for_pub']) || !isset($element['#required_for_pub'])) {
     return $element;
   }
   // Set the #required_for_pub property on the element itself.
-  if (empty($element['#required_for_pub']) && isset($form['#field_info'][$element['#field_name']])) {
-    $element['#required_for_pub'] = $form['#field_info'][$element['#field_name']]['required_for_pub'] == 1 ? TRUE : FALSE;
+  if ($element['#required_for_pub'] == FALSE && isset($form_state['field'][$element['#parents'][0]])) {
+    $element['#required_for_pub'] = $form_state['field'][$element['#parents'][0]]['und']['instance']['required_for_pub'] == 1 ? TRUE : FALSE;
   }
   return $element;
 }
@@ -96,22 +108,18 @@ function required_for_pub_element_process($element, $edit, &$form_state, $form)
  * Prevent publishing of the node if field not filled.
  */
 function required_for_pub_element_validate($element, &$form_state) {
-  if (!empty($element['#required_for_pub'])) {
-    // Get all the different widgets of a field
-    $element_children = array();
-    foreach (element_children($element) as $child) {
-      if (strpos($child, '_') !== 0) {
-        $element_children[] = $child;
-      }
-    }
-    if (required_for_pub_is_empty($element, $element_children)) {
+  if ($element['#required_for_pub'] && $form_state['values']['op'] == 'Submit') {
+    if (required_for_pub_is_empty($element)) {
       $form_state['values']['status'] = 0;
       drupal_set_message(t('%field field is required for publishing.', array('%field' => $element['#title'])), 'warning');
+      // TODO: This method could cause something wrong, but I need this command to prevent save form.
+      form_set_error(t('%field field is required for publishing.'));
+      // TODO: D7 Multistep integration.
       // Multistep integration - Keep the status of the current step as incomplete.
-      if (module_exists('multistep') && variable_get('multistep_expose_' . $form_state['values']['type'], 'disabled') == 'enabled') {
+      /* if (module_exists('multistep') && variable_get('multistep_expose_' . $form_state['values']['type'], 'disabled') == 'enabled') {
         $step = _multistep_get_current_step($form_state['values']['type']);
         $form_state['values']['required_for_pub'][$step] = 'unsubmitted';
-      }
+      } */
     }
   }
 }
@@ -119,12 +127,9 @@ function required_for_pub_element_validate($element, &$form_state) {
 /**
  * Check whether the field element is empty.
  */
-function required_for_pub_is_empty($element, $element_children = array()) {
-  foreach ($element_children as $child) {
-    if ((!count($element['#value'][$child]) || (is_string($element['#value'][$child]) && strlen(trim($element['#value'][$child])) == 0))
-    || (is_array($element['#value'][$child]) && count($element['#value'][$child]) == 1 && array_key_exists(0, $element['#value'][$child]) && is_null($element['#value'][$child][0]))) {
-      return TRUE;
-    }
+function required_for_pub_is_empty($element) {
+  if (empty($element['#value']) || (is_string($element['#value']) && strlen(trim($element['#value'])) == 0)) {
+    return TRUE;
   }
   return FALSE;
 }
@@ -133,42 +138,26 @@ function required_for_pub_is_empty($element, $element_children = array()) {
  * Implementation of hook_multistep_update_status().
  * If a required_for_pub field is empty, keep the status of the current step as incomplete.
  */
-function required_for_pub_multistep_update_status($form_state, $status, $step) {
+// TODO: D7 Multistep integration.
+/*function required_for_pub_multistep_update_status($form_state, $status, $step) {
   $step = _multistep_get_current_step($form_state['values']['type']);
   return $form_state['values']['required_for_pub'][$step];
-}
-
-/**
- * Implementation of hook_content_is_empty().
- */
-function required_for_pub_content_is_empty($item, $field) {
-  if (!$field['#required_for_pub']) {
-    return;
-  }
-  if (empty($item['value']) && (string)$item['value'] !== '0') {
-    return TRUE;
-  }
-  return FALSE;
-}
+} */
 
 /**
  * Add the required asterisk to the field label.
  */
 function required_for_pub_element_required(&$html, $element) {
-  if (!empty($element['#required_for_pub'])) {
-    // Get all the different widgets of a field
-    foreach (element_children($element) as $child) {
-      if (strpos($child, '_') !== 0) {
-        // Text fields will use this
-        $title_from = '<label for="' . $element[$child]['#id'] . '">' . $element[$child]['#title'] . ': </label>';
-        $title_to = '<label for="' . $element[$child]['#id'] . '">' . $element[$child]['#title'] . ': <span class="form-required" title="' . t('This field is required for publishing.') . '">*</span></label>';
-        $html = str_replace($title_from, $title_to, $html);
-        // Option widgets need this
-        $title_from = '<label>' . $element[$child]['#title'] . ': </label>';
-        $title_to = '<label>' . $element[$child]['#title'] . ': <span class="form-required" title="' . t('This field is required for publishing.') . '">*</span></label>';
-        $html = str_replace($title_from, $title_to, $html);
-      }
-    }
+  if ($element['#required_for_pub']) {
+    // Text fields will use this
+    $title_from = '<label for="' . $element['#id'] . '">' . $element['#title'] . ' </label>';
+    $title_to = '<label for="' . $element['#id'] . '">' . $element['#title'] . ' <span class="form-required" title="' . t('This field is required for publishing.') . '">*</span></label>';
+    $html = str_replace($title_from, $title_to, $html);
+    // TODO: Need add option widget.
+    // Option widgets need this
+    /*$title_from = '<label>' . $element[$child]['#title'] . ': </label>';
+    $title_to = '<label>' . $element[$child]['#title'] . ': <span class="form-required" title="' . t('This field is required for publishing.') . '">*</span></label>';
+    $html = str_replace($title_from, $title_to, $html);*/
   }
   return $html;
 }
