--- modules/menu/menu.admin.inc 2010-10-20 09:40:59.000000000 +0200 +++ modules/menu/menu.admin.inc 2010-10-29 14:39:47.048000000 +0200 @@ -385,6 +385,19 @@ function menu_edit_item_validate($form, if (!trim($item['link_path']) || !drupal_valid_path($item['link_path'], TRUE)) { form_set_error('link_path', t("The path '@link_path' is either invalid or you do not have access to it.", array('@link_path' => $item['link_path']))); } + elseif (preg_match('/^node\/(\d+)/', trim($item['link_path']), $matches)) { + $type = db_query("SELECT type FROM {node} WHERE nid = :nid", array(':nid' => $matches[1]))->fetchField(); + if ($type) { + $type_menus = variable_get('menu_options_'. $type, array('main-menu' => 'main-menu')); + list($menu_name, $plid) = explode(':', $item['parent']); + if (!in_array($menu_name, $type_menus)) { + form_set_error('parent', t("The %menu_title menu cannot contain links to the path '@link_path'.", array( + '%menu_title' => substr($form['parent']['#options'][$menu_name .':0'], 1, -1), + '@link_path' => $item['link_path'], + ))); + } + } + } } /**