diff --git a/auto_nodetitle.module b/auto_nodetitle.module
index 30e6e4f..1b72107 100644
--- a/auto_nodetitle.module
+++ b/auto_nodetitle.module
@@ -23,18 +23,19 @@ function auto_nodetitle_permission() {
 }
 
 /**
- * Implements hook_form_FORM_ID_alter() for the node form.
+ * Implements hook_field_attach_form().
  */
-function auto_nodetitle_form_node_form_alter(&$form, &$form_state, $form_id) {
-  if (auto_nodetitle_get_setting($form['#node']->type) == AUTO_NODETITLE_ENABLED) {
-    // We will autogenerate the title later, just hide the title field in the
-    // meanwhile.
-    $form['title']['#value'] = 'ant';
-    $form['title']['#type'] = 'value';
-    $form['title']['#required'] = FALSE;
-  }
-  elseif (auto_nodetitle_get_setting($form['#node']->type) == AUTO_NODETITLE_OPTIONAL) {
-    $form['title']['#required'] = FALSE;
+function auto_nodetitle_field_attach_form($entity_type, $entity, &$form, &$form_state, $langcode) {
+  if ($entity_type == 'node') {
+    $setting = auto_nodetitle_get_setting($entity->type);
+    if ($setting == AUTO_NODETITLE_ENABLED) {
+      $form['title']['#value'] = 'ant';
+      $form['title']['#type'] = 'value';
+      $form['title']['#required'] = FALSE;
+    }
+    elseif ($setting == AUTO_NODETITLE_OPTIONAL) {
+      $form['title']['#required'] = FALSE;
+    }
   }
 }
 
