From 2651654d090075bd2b712063bfe0f6f01cfef7d4 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 1 Aug 2010 23:33:18 +0000 Subject: - Patch #378064 by glipay: description field missing in menu settings on node form. --- modules/menu/menu.admin.inc | 2 +- modules/menu/menu.module | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'modules/menu') diff --git a/modules/menu/menu.admin.inc b/modules/menu/menu.admin.inc index 5ff35d138..4c9c0c5d3 100644 --- a/modules/menu/menu.admin.inc +++ b/modules/menu/menu.admin.inc @@ -308,7 +308,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) { '#title' => t('Description'), '#default_value' => isset($item['options']['attributes']['title']) ? $item['options']['attributes']['title'] : '', '#rows' => 1, - '#description' => t('The description displayed when hovering over a menu link.'), + '#description' => t('Shown when hovering over the menu link.'), ); $form['enabled'] = array( '#type' => 'checkbox', diff --git a/modules/menu/menu.module b/modules/menu/menu.module index 9686a57bf..57db01229 100644 --- a/modules/menu/menu.module +++ b/modules/menu/menu.module @@ -508,9 +508,13 @@ function menu_node_save($node) { elseif (trim($link['link_title'])) { $link['link_title'] = trim($link['link_title']); $link['link_path'] = "node/$node->nid"; - // If not already set, use the node's title as link title attribute. - if (empty($link['options']['attributes']['title']) && !$link['customized']) { - $link['options']['attributes']['title'] = trim($node->title); + if (trim($link['description'])) { + $link['options']['attributes']['title'] = trim($link['description']); + } + else { + // If the description field was left empty, remove the title attribute + // from the menu link. + unset($link['options']['attributes']['title']); } if (!menu_link_save($link)) { drupal_set_message(t('There was an error saving the menu link.'), 'error'); @@ -637,6 +641,14 @@ function menu_form_alter(&$form, $form_state, $form_id) { '#default_value' => $link['link_title'], ); + $form['menu']['link']['description'] = array( + '#type' => 'textarea', + '#title' => t('Description'), + '#default_value' => isset($link['options']['attributes']['title']) ? $link['options']['attributes']['title'] : '', + '#rows' => 1, + '#description' => t('Shown when hovering over the menu link.'), + ); + $default = ($link['mlid'] ? $link['menu_name'] . ':' . $link['plid'] : variable_get('menu_parent_' . $type, 'main-menu:0')); // @todo This will fail with the new selective menus per content type. if (!isset($options[$default])) { -- cgit v1.2.3