Commit d4f4d3c3 authored by webchick's avatar webchick
Browse files

#664020 by casey and Bojhan: Removed Menu settings fieldset.

parent a571da92
......@@ -237,32 +237,23 @@ function theme_menu_overview_form($variables) {
* Menu callback; Build the menu link editing form.
*/
function menu_edit_item($form, &$form_state, $type, $item, $menu) {
$form['menu'] = array(
'#type' => 'fieldset',
'#title' => t('Menu settings'),
'#collapsible' => FALSE,
'#tree' => TRUE,
'#weight' => -2,
'#attributes' => array('class' => array('menu-item-form')),
'#item' => $item,
);
if ($type == 'add' || empty($item)) {
// This is an add form, initialize the menu link.
$item = array('link_title' => '', 'mlid' => 0, 'plid' => 0, 'menu_name' => $menu['menu_name'], 'weight' => 0, 'link_path' => '', 'options' => array(), 'module' => 'menu', 'expanded' => 0, 'hidden' => 0, 'has_children' => 0);
}
$form['menu']['link_title'] = array('#type' => 'textfield',
$form['link_title'] = array(
'#type' => 'textfield',
'#title' => t('Menu link title'),
'#default_value' => $item['link_title'],
'#description' => t('The text to be used for this link in the menu.'),
'#required' => TRUE,
);
foreach (array('link_path', 'mlid', 'module', 'has_children', 'options') as $key) {
$form['menu'][$key] = array('#type' => 'value', '#value' => $item[$key]);
$form[$key] = array('#type' => 'value', '#value' => $item[$key]);
}
// Any item created or edited via this interface is considered "customized".
$form['menu']['customized'] = array('#type' => 'value', '#value' => 1);
$form['menu']['original_item'] = array('#type' => 'value', '#value' => $item);
$form['customized'] = array('#type' => 'value', '#value' => 1);
$form['original_item'] = array('#type' => 'value', '#value' => $item);
$path = $item['link_path'];
if (isset($item['options']['query'])) {
......@@ -272,7 +263,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
$path .= '#' . $item['options']['fragment'];
}
if ($item['module'] == 'menu') {
$form['menu']['link_path'] = array(
$form['link_path'] = array(
'#type' => 'textfield',
'#title' => t('Path'),
'#default_value' => $path,
......@@ -288,26 +279,26 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
);
}
else {
$form['menu']['_path'] = array(
$form['_path'] = array(
'#type' => 'item',
'#title' => t('Path'),
'#description' => l($item['link_title'], $item['href'], $item['options']),
);
}
$form['menu']['description'] = array(
$form['description'] = array(
'#type' => 'textarea',
'#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.'),
);
$form['menu']['enabled'] = array(
$form['enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enabled'),
'#default_value' => !$item['hidden'],
'#description' => t('Menu links that are not enabled will not be listed in any menu.'),
);
$form['menu']['expanded'] = array(
$form['expanded'] = array(
'#type' => 'checkbox',
'#title' => t('Show as expanded'),
'#default_value' => $item['expanded'],
......@@ -320,7 +311,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
if (!isset($options[$default])) {
$default = 'navigation:0';
}
$form['menu']['parent'] = array(
$form['parent'] = array(
'#type' => 'select',
'#title' => t('Parent link'),
'#default_value' => $default,
......@@ -328,7 +319,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
'#description' => t('The maximum depth for a link and all its children is fixed at !maxdepth. Some menu links may not be available as parents if selecting them would exceed this limit.', array('!maxdepth' => MENU_MAX_DEPTH)),
'#attributes' => array('class' => array('menu-title-select')),
);
$form['menu']['weight'] = array(
$form['weight'] = array(
'#type' => 'weight',
'#title' => t('Weight'),
'#delta' => 50,
......@@ -337,7 +328,6 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
);
$form['submit'] = array('#type' => 'submit', '#value' => t('Save'));
return $form;
}
......@@ -345,7 +335,7 @@ function menu_edit_item($form, &$form_state, $type, $item, $menu) {
* Validate form values for a menu link being added or edited.
*/
function menu_edit_item_validate($form, &$form_state) {
$item = &$form_state['values']['menu'];
$item = &$form_state['values'];
$normal_path = drupal_get_normal_path($item['link_path']);
if ($item['link_path'] != $normal_path) {
drupal_set_message(t('The menu system stores system paths only, but will use the URL alias for display. %link_path has been stored as %normal_path', array('%link_path' => $item['link_path'], '%normal_path' => $normal_path)));
......@@ -372,14 +362,14 @@ function menu_edit_item_validate($form, &$form_state) {
* Submit function for the delete button on the menu item editing form.
*/
function menu_item_delete_submit($form, &$form_state) {
$form_state['redirect'] = 'admin/structure/menu/item/' . $form_state['values']['menu']['mlid'] . '/delete';
$form_state['redirect'] = 'admin/structure/menu/item/' . $form_state['values']['mlid'] . '/delete';
}
/**
* Process menu and menu item add/edit form submissions.
*/
function menu_edit_item_submit($form, &$form_state) {
$item = &$form_state['values']['menu'];
$item = &$form_state['values'];
// The value of "hidden" is the opposite of the value
// supplied by the "enabled" checkbox.
......
......@@ -242,13 +242,13 @@ class MenuTestCase extends DrupalWebTestCase {
$title = '!link_' . $this->randomName(16);
$edit = array(
'menu[link_path]' => $link,
'menu[link_title]' => $title,
'menu[description]' => '',
'menu[enabled]' => TRUE, // Use this to disable the menu and test.
'menu[expanded]' => TRUE, // Setting this to true should test whether it works when we do the std_user tests.
'menu[parent]' => $menu_name . ':' . $plid,
'menu[weight]' => '0',
'link_path' => $link,
'link_title' => $title,
'description' => '',
'enabled' => TRUE, // Use this to disable the menu and test.
'expanded' => TRUE, // Setting this to true should test whether it works when we do the std_user tests.
'parent' => $menu_name . ':' . $plid,
'weight' => '0',
);
// Add menu link.
......@@ -288,8 +288,8 @@ class MenuTestCase extends DrupalWebTestCase {
function addInvalidMenuLink($menu_name = 'navigation') {
foreach (array('-&-', 'admin/config/people/permissions') as $link_path) {
$edit = array(
'menu[link_path]' => $link_path,
'menu[link_title]' => 'title',
'link_path' => $link_path,
'link_title' => 'title',
);
$this->drupalPost("admin/structure/menu/manage/$menu_name/add", $edit, t('Save'));
$this->assertRaw(t("The path '@path' is either invalid or you do not have access to it.", array('@path' => $link_path)), 'Menu link was not created');
......@@ -344,7 +344,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Edit menu link.
$edit = array();
$edit['menu[link_title]'] = $title;
$edit['link_title'] = $title;
$this->drupalPost("admin/structure/menu/item/$mlid/edit", $edit, t('Save'));
$this->assertResponse(200);
// Unlike most other modules, there is no confirmation message displayed.
......@@ -421,7 +421,7 @@ class MenuTestCase extends DrupalWebTestCase {
*/
function disableMenuLink($item) {
$mlid = $item['mlid'];
$edit['menu[enabled]'] = FALSE;
$edit['enabled'] = FALSE;
$this->drupalPost("admin/structure/menu/item/$mlid/edit", $edit, t('Save'));
// Unlike most other modules, there is no confirmation message displayed.
......@@ -438,7 +438,7 @@ class MenuTestCase extends DrupalWebTestCase {
*/
function enableMenuLink($item) {
$mlid = $item['mlid'];
$edit['menu[enabled]'] = TRUE;
$edit['enabled'] = TRUE;
$this->drupalPost("admin/structure/menu/item/$mlid/edit", $edit, t('Save'));
// Verify in the database.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment