diff --git a/conflict.module b/conflict.module
index d35d743..1877729 100644
--- a/conflict.module
+++ b/conflict.module
@@ -89,28 +89,20 @@ function conflict_entity_load(array $entities, $entity_type_id) {
 }
 
 /**
- * Implements hook_form_alter().
+ * Implements hook_entity_prepare_form().
  */
-function conflict_form_alter(&$form, FormStateInterface $form_state, $form_id) {
+function conflict_entity_prepare_form(EntityInterface $entity, $operation, FormStateInterface $form_state) {
   $form_object = $form_state->getFormObject();
   if (!($form_object instanceof EntityFormInterface)) {
     return;
   }
-  conflict_prepare_entity_form($form, $form_state, $form_object->getEntity());
-}
 
-/**
- * Helper method for preparing entity forms for conflict resolution.
- *
- * The entity is present as a parameter to support inline entity forms.
- */
-function conflict_prepare_entity_form(&$form, FormStateInterface $form_state, EntityInterface $entity, $inline_entity_form = FALSE) {
   $conflict_supported = $form_state->get('conflict.supported');
   if ($conflict_supported === FALSE) {
     return;
   }
   elseif (is_null($conflict_supported)) {
-    $route =  \Drupal::routeMatch()->getRouteObject();
+    $route = \Drupal::routeMatch()->getRouteObject();
     if (!($route && ($route_defaults = $route->getDefaults()) && isset($route_defaults['_entity_form']))) {
       $form_state->set('conflict.supported', FALSE);
       return;
@@ -122,7 +114,29 @@ function conflict_prepare_entity_form(&$form, FormStateInterface $form_state, En
     // Flags the form that on it a conflict resolution is supported.
     $form_state->set('conflict.supported', TRUE);
   }
+}
 
+/**
+ * Implements hook_form_alter().
+ */
+function conflict_form_alter(&$form, FormStateInterface $form_state, $form_id) {
+  $form_object = $form_state->getFormObject();
+  if (!($form_object instanceof EntityFormInterface)) {
+    return;
+  }
+
+  $conflict_supported = $form_state->get('conflict.supported');
+  if ($conflict_supported) {
+    conflict_prepare_entity_form($form, $form_state, $form_object->getEntity());
+  }
+}
+
+/**
+ * Helper method for preparing entity forms for conflict resolution.
+ *
+ * The entity is present as a parameter to support inline entity forms.
+ */
+function conflict_prepare_entity_form(&$form, FormStateInterface $form_state, EntityInterface $entity, $inline_entity_form = FALSE) {
   $entity_type_id = $entity->getEntityTypeId();
   $bundle = $entity->bundle();
   $entity_type_manager = \Drupal::entityTypeManager();
