diff --git a/modules/editor_ckeditor/editor_ckeditor.module b/modules/editor_ckeditor/editor_ckeditor.module
index b6d8bf5..bb70d89 100755
--- a/modules/editor_ckeditor/editor_ckeditor.module
+++ b/modules/editor_ckeditor/editor_ckeditor.module
@@ -55,11 +55,92 @@ function editor_ckeditor_menu() {
     'type' => MENU_CALLBACK,
     'file' => 'includes/editor_ckeditor.pages.inc',
   );
+  $items['editor-ckeditor/autocomplete-entity/%/%'] = array(
+    'title' => 'Autocomplete for embedded entities',
+    'page callback' => 'editor_ckeditor_autocomplete_entity',
+    'page arguments' => array(2, 3),
+    'access callback' => 'entity_access',
+    'access arguments' => array('view', 2),
+    'type' => MENU_CALLBACK
+  );
 
   return $items;
 }
 
 /**
+ * Loads a text format object from the database.
+ *
+ * @param $format_id
+ *   The format ID.
+ *
+ * @return
+ *   A fully-populated text format object, if the requested format exists and
+ *   is enabled. If the format does not exist, or exists in the database but
+ *   has been marked as disabled, FALSE is returned.
+ *
+ * @see filter_format_exists()
+ */
+function editor_ckeditor_filter_format_load($format_id) {
+  $formats = filter_formats();
+
+  return isset($formats[$format_id]) ? $formats[$format_id] : FALSE;
+}
+
+/**
+ * Page callback: Autocomplete for entities.
+ *
+ * @param $entity_type
+ *   The type of entity to search for.
+ * @param $entity_type_bundles
+ *   The entity type bundles to restrict results to.
+ * @param $string
+ *   The search string.
+ *
+ * @return
+ *   Any matching entities output as JSON.
+ */
+function editor_ckeditor_autocomplete_entity($entity_type, $entity_type_bundles = NULL, $string) {
+  $matches = array();
+
+  $entity_type_info = entity_get_info($entity_type);
+
+  // Prevent errors if the entity type has no label key.
+  if (empty($entity_type_info['entity keys']['label'])) {
+    return drupal_json_output($matches);
+  }
+
+  $query = new EntityFieldQuery();
+  $query->entityCondition('entity_type', $entity_type)
+    ->propertyCondition($entity_type_info['entity keys']['label'], $string, 'STARTS_WITH')
+    ->range(0, 10)
+    ->propertyOrderBy($entity_type_info['entity keys']['label'], 'DESC')
+    ->execute();
+
+  // Add optional bundle restrictions.
+  if (!empty($entity_type_bundles)) {
+    $query->entityCondition('bundle', array_keys($entity_type_bundles));
+  }
+
+  $results = $query->execute();
+
+  if (!empty($results)) {
+    $ids = array_keys($results[$entity_type]);
+    $entities = entity_load($entity_type, $ids);
+
+    foreach ($entities as $entity) {
+      $uri = entity_uri($entity_type, $entity);
+      $url = $uri && !empty($uri['path']) ? url($uri['path'], $uri['options']) : FALSE;
+
+      $label = entity_label($entity_type, $entity);
+
+      $matches[$url] = check_plain($label);
+    }
+  }
+
+  return drupal_json_output($matches);
+}
+
+/**
  * Implements hook_theme().
  */
 function editor_ckeditor_theme() {
diff --git a/modules/editor_ckeditor/includes/editor_ckeditor.pages.inc b/modules/editor_ckeditor/includes/editor_ckeditor.pages.inc
index 0e21943..ce07243 100644
--- a/modules/editor_ckeditor/includes/editor_ckeditor.pages.inc
+++ b/modules/editor_ckeditor/includes/editor_ckeditor.pages.inc
@@ -28,6 +28,45 @@ function editor_ckeditor_editor_dialog_link_form($form, &$form_state, $format) {
     drupal_set_title(t('Insert link'));
   }
 
+  // Determine the currently selected entity type.
+  $selected = FALSE;
+
+  if (isset($form_state['values']['entity_type'])) {
+    $selected  = $form_state['values']['entity_type'];
+  }
+  elseif (!empty($values['href'])) {
+    $router_item = menu_get_item(ltrim($values['href'], '/'));
+
+    if (isset($router_item['load_functions'][1]) && !empty($router_item['map'][1]) && $router_item['load_functions'][1] == $router_item['map'][0] . '_load') {
+      $selected = $router_item['map'][0];
+    }
+  }
+
+  global $user;
+
+  $options = array();
+  $entity_types = entity_get_info();
+
+  foreach ($entity_types as $entity_type => $info) {
+    if (!empty($info['uri callback']) && entity_access('view', $entity_type, NULL, $user)) {
+      $options[$entity_type] = $info['label'];
+    }
+  }
+
+  $form['entity_type'] = array(
+    '#type' => 'select',
+    '#title' => t('Entity type'),
+    '#default_value' => $selected,
+    '#access' => count($options) > 1,
+    '#options' => $options,
+    '#empty_option' => t('- Select an entity type -'),
+    '#description' => t('Optionally create links to existing entities by selecting an entity type.'),
+    '#ajax' => array(
+      'callback' => 'editor_ckeditor_link_form_href_update',
+      'wrapper' => 'editor-ckeditor-link-href',
+    ),
+  );
+
   // Use a "textfield" rather than "url" to allow relative paths.
   $form['href'] = array(
     '#title' => t('URL'),
@@ -35,7 +74,15 @@ function editor_ckeditor_editor_dialog_link_form($form, &$form_state, $format) {
     '#element_validate' => array('_editor_ckeditor_editor_dialog_link_url_validate'),
     '#default_value' => isset($values['href']) ? $values['href'] : FALSE,
     '#parents' => array('attributes', 'href'),
+    '#prefix' => '<div id="editor-ckeditor-link-href">',
+    '#suffix' => '</div>',
   );
+
+  // Enable autocomplete if an entity type has been selected.
+  if ($selected) {
+    $form['href']['#autocomplete_path'] = 'editor-ckeditor/autocomplete-entity/' . $selected . '/' . NULL;
+  }
+
   $form['target'] = array(
     '#title' => t('Open in new window'),
     '#type' => 'checkbox',
@@ -60,6 +107,19 @@ function editor_ckeditor_editor_dialog_link_form($form, &$form_state, $format) {
 }
 
 /**
+ * Re-renders the href form element when the entity type selection changes.
+ *
+ * This function is called via Ajax when the selected entity type is changed on
+ * the insert/edit link form.
+ *
+ * @return
+ *   The rendered parent page select element.
+ */
+function editor_ckeditor_link_form_href_update($form, $form_state) {
+  return $form['href'];
+}
+
+/**
  * Form callback: Display a form for inserting/editing a link.
  */
 function editor_ckeditor_editor_dialog_image_form($form, &$form_state, $format) {
