From 30b28d2d3a89d9690a3612f8cebc230df9c845ad Mon Sep 17 00:00:00 2001
From: Drave Robber <drave@right-here-tavern.info>
Date: Sat, 21 Apr 2012 15:38:06 +0300
Subject: [PATCH] Add redirect.module integration.

---
 mpac.module |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/mpac.module b/mpac.module
index 41414f6..a26697a 100755
--- a/mpac.module
+++ b/mpac.module
@@ -144,6 +144,21 @@ function mpac_form_shortcut_link_edit_alter(&$form, &$form_state) {
 }
 
 /**
+ * Implements hook_form_FORM_ID_alter().
+ *
+ * Change path field in add/edit redirect form to autocomplete field.
+ */
+function mpac_form_redirect_edit_form_alter(&$form, &$form_state) {
+  if ($form['redirect']['#type'] == 'textfield') {
+    $form['redirect']['#autocomplete_path'] = 'mpac/autocomplete/menu';
+    $form['redirect']['#description'] .= '<br />' . t("You may enter the title of the node you'd like to link to to get a list of all possible matches.");
+    if (module_exists('path')) {
+      $form['redirect']['#description'] .= ' ' . t('Matches marked with %marker are URL aliases.', array('%marker' => t('*')));
+    }
+  }
+}
+
+/**
  * Helper function to find all nodes containing the given title.
  *
  * @param $title
-- 
1.7.4.1

