2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
$output=t('<p>The menu module allows for customization of the menus. Menus are useful for providing navigation in your site. The main menu for navigation is the navigation menu. Menus appear in blocks on your site.</p>
$output=t('<p>The menu module allows for customization of the menus. Menus are useful for providing navigation in your site. The main menu for navigation is called the "navigation" menu. Menus appear in blocks on your site.</p>
<p>There is a special case for the display of "primary links" and "secondary links" (which are implemented as menus). These are sets of links which are usually displayed in the header of each page (depending on the currently active theme). Any menu can serve as the primary or secondary links, by modifying the settings for the menu module.</p>
<ul>
<ul>
<li>On the administer menu page administrators can "edit" to change the title, description, parent or weight of the menu item. Under the "operations" column, click on "enable/disable" to toggle the menu item on or off. Menu items which are disabled are not deleted; they are merely not available for navigating the site in the sidebar menu block. Note that the default menu items generated by the menu module cannot be deleted, only disabled.</li>
<li>On the administer menu page administrators can "edit" to change the title, description, parent or weight of the menu item. Under the "operations" column, click on "enable/disable" to toggle the menu item on or off. Menu items which are disabled are not deleted; they are merely not available for navigating the site in the sidebar menu block. Note that the default menu items generated by the menu module cannot be deleted, only disabled.</li>
<li>Using the "add menu" tab submit a title for a new custom menu. Once submitted, the new menu will appear in a list toward the bottom of the administer menu page underneath the main navigation menu.</li>
<li>Using the "add menu" tab submit a title for a new custom menu. Once submitted, the new menu will appear in a list toward the bottom of the administer menu page underneath the main navigation menu.</li>
<li>Use the "add menu item" tab to create new links in either the navigation or a custom menu. Select the parent item to place the new link within an existing menu structure. For top level menu items, choose the name of the menu in which the link is to be added.</li>
<li>Use the "add menu item" tab to create new links in either the navigation or a custom menu. Select the parent item to place the new link within an existing menu structure. For top level menu items, choose the name of the menu in which the link is to be added. This tab is also the way to define primary or secondary links for your site (by adding items to whatever menu is selected as your primary links menu).</li>
<li>To turn off the navigation menu block, administer the block page.</li>
</ul>
</ul>
');
');
$output.=t('<p>You can</p>
$output.=t('<p>You can</p>
...
@@ -26,8 +26,9 @@ function menu_help($section) {
...
@@ -26,8 +26,9 @@ function menu_help($section) {
<li>turn menus blocks on and off in the <a href="%admin-block">administer >> blocks</a>.</li>
<li>turn menus blocks on and off in the <a href="%admin-block">administer >> blocks</a>.</li>
<li>add a menu at <a href="%admin-menu-menu-add">administer >> menus >> add menu</a>.</li>
<li>add a menu at <a href="%admin-menu-menu-add">administer >> menus >> add menu</a>.</li>
<li>add a menu item at <a href="%admin-menu-item-add">administer >> menus >> add menu item</a>.</li>
<li>add a menu item at <a href="%admin-menu-item-add">administer >> menus >> add menu item</a>.</li>
<li>modify menu settings (in particular, to specify a menu to use for primary or secondary links) at <a href="%admin-settings-menus">administer >> settings >> menus</a>.</li>
$output.='<p>'.t('For more information please read the configuration and customization handbook <a href="%menu">Menu page</a>.',array('%menu'=>'http://drupal.org/handbook/modules/menu/')).'</p>';
$output.='<p>'.t('For more information please read the configuration and customization handbook <a href="%menu">Menu page</a>.',array('%menu'=>'http://drupal.org/handbook/modules/menu/')).'</p>';
return$output;
return$output;
case'admin/modules#description':
case'admin/modules#description':
...
@@ -54,9 +55,19 @@ function menu_menu($may_cache) {
...
@@ -54,9 +55,19 @@ function menu_menu($may_cache) {
'title'=>t('menus'),
'title'=>t('menus'),
'callback'=>'menu_overview',
'callback'=>'menu_overview',
'access'=>user_access('administer menu'));
'access'=>user_access('administer menu'));
$items[]=array('path'=>'admin/menu/list',
'title'=>t('list'),
'type'=>MENU_DEFAULT_LOCAL_TASK,
'weight'=>-10);
$items[]=array('path'=>'admin/menu/item/add',
'title'=>t('add menu item'),
'callback'=>'menu_edit_item_form',
'access'=>user_access('administer menu'),
'type'=>MENU_LOCAL_TASK);
$items[]=array('path'=>'admin/menu/item/edit',
$items[]=array('path'=>'admin/menu/item/edit',
'title'=>t('edit menu item'),
'title'=>t('edit menu item'),
'callback'=>'menu_edit_item',
'callback'=>'menu_edit_item_form',
'access'=>user_access('administer menu'),
'access'=>user_access('administer menu'),
'type'=>MENU_CALLBACK);
'type'=>MENU_CALLBACK);
$items[]=array('path'=>'admin/menu/item/reset',
$items[]=array('path'=>'admin/menu/item/reset',
...
@@ -71,24 +82,25 @@ function menu_menu($may_cache) {
...
@@ -71,24 +82,25 @@ function menu_menu($may_cache) {
'type'=>MENU_CALLBACK);
'type'=>MENU_CALLBACK);
$items[]=array('path'=>'admin/menu/item/delete',
$items[]=array('path'=>'admin/menu/item/delete',
'title'=>t('delete menu item'),
'title'=>t('delete menu item'),
'callback'=>'menu_edit_item_delete',
'callback'=>'menu_item_delete_form',
'access'=>user_access('administer menu'),
'access'=>user_access('administer menu'),
'type'=>MENU_CALLBACK);
'type'=>MENU_CALLBACK);
$items[]=array('path'=>'admin/menu/list',
'title'=>t('list'),
'type'=>MENU_DEFAULT_LOCAL_TASK,
'weight'=>-10);
$items[]=array('path'=>'admin/menu/menu/add',
$items[]=array('path'=>'admin/menu/menu/add',
'title'=>t('add menu'),
'title'=>t('add menu'),
'callback'=>'menu_add_menu',
'callback'=>'menu_edit_menu_form',
'access'=>user_access('administer menu'),
'access'=>user_access('administer menu'),
'type'=>MENU_LOCAL_TASK);
'type'=>MENU_LOCAL_TASK);
$items[]=array('path'=>'admin/menu/item/add',
$items[]=array('path'=>'admin/menu/menu/edit',
'title'=>t('add menu item'),
'title'=>t('edit menu'),
'callback'=>'menu_edit_item',
'callback'=>'menu_edit_menu_form',
'access'=>user_access('administer menu'),
'access'=>user_access('administer menu'),
'type'=>MENU_LOCAL_TASK);
'type'=>MENU_CALLBACK);
$items[]=array('path'=>'admin/menu/menu/delete',
'title'=>t('delete menu'),
'callback'=>'menu_item_delete_form',
'access'=>user_access('administer menu'),
'type'=>MENU_CALLBACK);
$items[]=array('path'=>'admin/settings/menu',
$items[]=array('path'=>'admin/settings/menu',
'title'=>t('menus'),
'title'=>t('menus'),
...
@@ -290,244 +302,182 @@ function menu_configure() {
...
@@ -290,244 +302,182 @@ function menu_configure() {
}
}
/**
/**
* Menu callback; handle the adding of a new menu.
* Menu callback; handle the adding/editing of a new menu.
*/
*/
functionmenu_add_menu(){
functionmenu_edit_menu_form($mid=0){
$op=isset($_POST['op'])?$_POST['op']:'';
if(arg(3)=='edit'){
$edit=isset($_POST['edit'])?$_POST['edit']:'';
if(!($item=db_fetch_array(db_query('SELECT * FROM {menu} WHERE mid = %d',$mid)))){
'#description'=>t('The description displayed when hovering over a menu item.'),
);
$path_description=t('The Drupal path this menu item links to. Enter %front to link to the front page.',array('%front'=>theme('placeholder','<front>')));
if($edit['type']&MENU_CREATED_BY_ADMIN){
$form['title']=array('#type'=>'textfield',
$form['path']=array('#type'=>'textfield',
'#title'=>t('Title'),
'#title'=>t('Path'),
'#default_value'=>$item['title'],
'#default_value'=>$edit['path'],
'#description'=>t('The name of the menu item.'),
'#description'=>$path_description,
'#required'=>TRUE,
'#required'=>TRUE,
);
);
$form['description']=array('#type'=>'textfield',
}
'#title'=>t('Description'),
else{
'#default_value'=>$item['description'],
$form['_path']=array('#type'=>'item',
'#description'=>t('The description displayed when hovering over a menu item.'),
'#description'=>t('If selected and this menu item has children, the menu will always appear expanded.'),
);
// Generate a list of possible parents (not including this item or descendants).
if($item['type']&MENU_CREATED_BY_ADMIN){
$options=menu_parent_options($edit['mid']);
$form['path']=array('#type'=>'textfield',
$form['pid']=array('#type'=>'select',
'#title'=>t('Path'),
'#title'=>t('Parent item'),
'#default_value'=>$item['path'],
'#default_value'=>$edit['pid'],
'#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'=>theme('placeholder','<front>'),'%add-node'=>theme('placeholder','node/add'),'%drupal'=>theme('placeholder','http://drupal.org'))),
'#options'=>$options,
'#required'=>TRUE,
);
);
}
$form['weight']=array('#type'=>'weight',
else{
'#title'=>t('Weight'),
$form['_path']=array('#type'=>'item',
'#default_value'=>$edit['weight'],
'#title'=>t('Path'),
'#description'=>t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'),
returnconfirm_form('menu_reset_item_form',$form,t('Are you sure you want to reset the item %item to its default values?',array('%item'=>theme('placeholder',$title))),'admin/menu',t('Any customizations will be lost. This action cannot be undone.'),t('Reset'));
menu_delete_item($mid);
}
drupal_set_message(t("The menu item was reset to its default settings."));
else{
drupal_goto('admin/menu');
drupal_not_found();
break;
default:
$title=db_result(db_query('SELECT title FROM {menu} WHERE mid = %d',$mid));