﻿diff --git a/references_dialog.dialog_widgets.inc b/references_dialog.dialog_widgets.inc
index be1fe31..c432f29 100644
--- a/references_dialog.dialog_widgets.inc
+++ b/references_dialog.dialog_widgets.inc
@@ -165,15 +165,20 @@ function references_dialog_entityreference_edit_link($element, $widget_settings,
     $entity_type = $field['settings']['target_type'];
     // Take "label (entity id)', match the id from parenthesis.
     if (preg_match("/.\((\d)\)/", $element['#default_value'], $matches)) {
-        $value = $matches[1];
-      }
+      $value = $matches[1];
+    }
     if (isset($value)) {
       $entity = current(entity_load($entity_type, array($value)));
+      $entity_info = entity_get_info($entity_type);
+      $bundle = NULL;
+      if (module_exists('eck') && isset($entity_info['module']) && $entity_info['module'] == 'eck') {
+        $bundle = $entity->type;
+      }
       if (entity_access('update', $entity_type, $entity)) {
         return array(
           array(
             'title' => t('Edit'),
-            'href' => references_dialog_get_admin_path($entity_type, 'edit', NULL, $entity),
+            'href' => references_dialog_get_admin_path($entity_type, 'edit', $bundle, $entity),
           ),
         );
       }
diff --git a/references_dialog.module b/references_dialog.module
index f4d14bb..3fab69f 100644
--- a/references_dialog.module
+++ b/references_dialog.module
@@ -619,6 +619,19 @@ function references_dialog_references_dialog_entity_admin_paths() {
       'edit' => 'media/[entity_id]/edit',
     );
   }
+
+  if (module_exists('eck')) {
+    $info = entity_get_info();
+    foreach ($info as $entity_type_name => $entity_type) {
+      if (isset($entity_type['module']) && $entity_type['module'] == 'eck') {
+        $admin_paths[$entity_type_name] = array(
+          'edit' => 'admin/structure/eck/' . $entity_type_name . '/[bundle]/[entity_id]/edit',
+          'add' => 'admin/structure/eck/' . $entity_type_name . '/[bundle]/add',
+        );
+      }
+    }
+  }
+
   return $admin_paths;
 }
