You are here

function mpac_form_menu_edit_item_alter in Multi-path autocomplete 7

Same name and namespace in other branches
  1. 6 mpac.module \mpac_form_menu_edit_item_alter()

Implement hook_form_FORM_ID_alter().

Change path field to autocomplete field.

File

./mpac.module, line 98
Find node paths on menu item creation via autocomplete.

Code

function mpac_form_menu_edit_item_alter(&$form, &$form_state) {
  if ($form['link_path']['#type'] == 'textfield') {
    $form['link_path']['#autocomplete_path'] = 'mpac/autocomplete/menu';
    $form['link_path']['#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['link_path']['#description'] .= ' ' . t('Matches marked with %marker are URL aliases.', array(
        '%marker' => t('*'),
      ));
    }
  }
}