diff --git a/modules/shortcut/shortcut.admin.inc b/modules/shortcut/shortcut.admin.inc index 9735d37..ee4e89f 100644 --- a/modules/shortcut/shortcut.admin.inc +++ b/modules/shortcut/shortcut.admin.inc @@ -461,7 +461,7 @@ function _shortcut_link_form_elements($shortcut_link = NULL) { ); } else { - $shortcut_link['link_path'] = drupal_get_path_alias($shortcut_link['link_path']); + $shortcut_link['link_path'] = ($shortcut_link['link_path'] == '') ? '' : drupal_get_path_alias($shortcut_link['link_path']); } $form['shortcut_link']['#tree'] = TRUE; @@ -509,10 +509,13 @@ function shortcut_link_edit_validate($form, &$form_state) { */ function shortcut_link_edit_submit($form, &$form_state) { // Normalize the path in case it is an alias. - $form_state['values']['shortcut_link']['link_path'] = drupal_get_normal_path($form_state['values']['shortcut_link']['link_path']); + $shortcut_path = drupal_get_normal_path($form_state['values']['shortcut_link']['link_path']); + if (empty($shortcut_path)) { + $shortcut_path = ''; + } + $form_state['values']['shortcut_link']['link_path'] = $shortcut_path; $shortcut_link = array_merge($form_state['values']['original_shortcut_link'], $form_state['values']['shortcut_link']); - menu_link_save($shortcut_link); $form_state['redirect'] = 'admin/config/user-interface/shortcut/' . $shortcut_link['menu_name']; drupal_set_message(t('The shortcut %link has been updated.', array('%link' => $shortcut_link['link_title']))); @@ -566,6 +569,9 @@ function shortcut_admin_add_link($shortcut_link, &$shortcut_set, $limit = NULL) // Normalize the path in case it is an alias. $shortcut_link['link_path'] = drupal_get_normal_path($shortcut_link['link_path']); + if (empty($shortcut_link['link_path'])) { + $shortcut_link['link_path'] = ''; + } // Add the link to the end of the list. $shortcut_set->links[] = $shortcut_link; diff --git a/modules/shortcut/shortcut.module b/modules/shortcut/shortcut.module index 8642d9d..ee3b760 100644 --- a/modules/shortcut/shortcut.module +++ b/modules/shortcut/shortcut.module @@ -618,7 +618,8 @@ function shortcut_valid_link($path) { $path = $normal_path; } // Only accept links that correspond to valid paths on the site itself. - return !url_is_external($path) && menu_get_item($path); + // An empty path is valid too and will be converted to . + return (!url_is_external($path) && menu_get_item($path)) || empty($path) || $path == ''; } /**