You are here

function mpac_form_shortcut_link_edit_alter in Multi-path autocomplete 7

Implement hook_form_FORM_ID_alter().

Change path field for existing shortcuts to autocomplete field.

File

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

Code

function mpac_form_shortcut_link_edit_alter(&$form, &$form_state) {
  if ($form['shortcut_link']['link_path']['#type'] == 'textfield') {
    $form['shortcut_link']['link_path']['#autocomplete_path'] = 'mpac/autocomplete/shortcut';
    $form['shortcut_link']['link_path']['#description'] .= '<br />' . t("You may enter the title of a node or a page you'd like to link to to get a list of all possible matches.");
    if (module_exists('path')) {
      $form['shortcut_link']['link_path']['#description'] .= ' ' . t('Matches marked with %marker are URL aliases.', array(
        '%marker' => t('*'),
      ));
    }
  }
}