@@ -1361,9 +1361,11 @@ function _menu_navigation_links_rebuild($menu) {
array_multisort($sort,SORT_NUMERIC,$menu_links);
foreach($menu_linksas$item){
$existing_item=db_fetch_array(db_query("SELECT mlid, customized FROM {menu_links} WHERE menu_name = '%s' AND link_path = '%s' AND module = 'system'",$item['menu_name'],$item['link_path']));
$existing_item=db_fetch_array(db_query("SELECT mlid, menu_name, plid, customized FROM {menu_links} WHERE link_path = '%s' AND module = 'system'",$item['link_path']));
// Any item created or edited via this interface is considered "customized".
...
...
@@ -271,6 +270,13 @@ function menu_edit_item(&$form_state, $type, $item, $menu) {
'#description'=>t('The path this menu item links to. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.',array('%front'=>'<front>','%add-node'=>'node/add','%drupal'=>'http://drupal.org')),
'#required'=>TRUE,
);
$form['delete']=array(
'#type'=>'submit',
'#value'=>t('Delete'),
'#access'=>$item['mlid'],
'#submit'=>array('menu_item_delete_submit'),
'#weight'=>10,
);
}
else{
$form['_path']=array(
...
...
@@ -300,11 +306,15 @@ function menu_edit_item(&$form_state, $type, $item, $menu) {
);
// Generate a list of possible parents (not including this item or descendants).
$mlid=db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = 'node/%d' AND menu_name = '%s' AND module = 'menu' ORDER BY mlid ASC",$node->nid,$menu_name));
// Give priority to the default menu
$mlid=db_result(db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = 'node/%d' AND menu_name = '%s' AND module = 'menu' ORDER BY mlid ASC",$node->nid,$menu_name,0,1));
// Check all menus if a link does not exist in the default menu.
if(!$mlid){
$mlid=db_result(db_query_range("SELECT mlid FROM {menu_links} WHERE link_path = 'node/%d' AND module = 'menu' ORDER BY mlid ASC",$node->nid,0,1));
}
if($mlid){
$item=menu_link_load($mlid);
}
...
...
@@ -572,8 +597,7 @@ function menu_nodeapi(&$node, $op) {
}
/**
* Implementation of hook_form_alter().
* Add menu item fields to the node form.
* Implementation of hook_form_alter(). Adds menu item fields to the node form.
* Return an associative array of the custom menus names.
*
...
...
@@ -639,7 +676,7 @@ function menu_form_alter(&$form, $form_state, $form_id) {
* An array with the machine-readable names as the keys, and human-readable
* titles as the values.
*/
functionmenu_get_menus($all=FALSE){
functionmenu_get_menus($all=TRUE){
$sql='SELECT * FROM {menu_custom}'.($all?'':" WHERE menu_name NOT IN ('navigation', 'primary-links', 'secondary-links')").' ORDER BY title';
$result=db_query($sql);
...
...
@@ -656,16 +693,15 @@ function menu_get_menus($all = FALSE) {
functionmenu_configure(){
$form['intro']=array(
'#type'=>'item',
'#value'=>t('The menu module allows on-the-fly creation of menu links in the content authoring forms. The following option limits the menus in which a new link may be added. E.g., this can be used to force new menu items to be created in the primary links menu or to hide admin menu items.'),
'#value'=>t('The menu module allows on-the-fly creation of menu links in the content authoring forms. The following option sets the default menu in which a new link will be added.'),