#651712 by carlos8f: Fixed bug where rendered menu tree links do not include proper attributes (with tests).
parent
8e22c48576
commit
3254e88fde
|
@ -921,7 +921,7 @@ function menu_tree_output($tree) {
|
||||||
$element['#attributes']['class'] = $class;
|
$element['#attributes']['class'] = $class;
|
||||||
$element['#title'] = $data['link']['title'];
|
$element['#title'] = $data['link']['title'];
|
||||||
$element['#href'] = $data['link']['href'];
|
$element['#href'] = $data['link']['href'];
|
||||||
$element['#localized_options'] = !empty($data['localized_options']) ? $data['localized_options'] : array();
|
$element['#localized_options'] = !empty($data['link']['localized_options']) ? $data['link']['localized_options'] : array();
|
||||||
$element['#below'] = $data['below'] ? menu_tree_output($data['below']) : $data['below'];
|
$element['#below'] = $data['below'] ? menu_tree_output($data['below']) : $data['below'];
|
||||||
$element['#original_link'] = $data['link'];
|
$element['#original_link'] = $data['link'];
|
||||||
// Index using the link's unique mlid.
|
// Index using the link's unique mlid.
|
||||||
|
|
|
@ -240,6 +240,31 @@ class MenuIncTestCase extends DrupalWebTestCase {
|
||||||
$this->assertEqual(menu_test_static_variable(), 'delete', t('hook_menu_link_delete() fired correctly'));
|
$this->assertEqual(menu_test_static_variable(), 'delete', t('hook_menu_link_delete() fired correctly'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test menu link 'options' storage and rendering.
|
||||||
|
*/
|
||||||
|
function testMenuLinkOptions() {
|
||||||
|
// Create a menu link with options.
|
||||||
|
$menu_link = array(
|
||||||
|
'link_title' => 'Menu link options test',
|
||||||
|
'link_path' => 'node',
|
||||||
|
'module' => 'menu_test',
|
||||||
|
'options' => array(
|
||||||
|
'attributes' => array(
|
||||||
|
'title' => 'Test title attribute',
|
||||||
|
),
|
||||||
|
'query' => array(
|
||||||
|
'testparam' => 'testvalue',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
menu_link_save($menu_link);
|
||||||
|
|
||||||
|
// Load front page.
|
||||||
|
$this->drupalGet('node');
|
||||||
|
$this->assertRaw('title="Test title attribute"', t('Title attribute of a menu link renders.'));
|
||||||
|
$this->assertRaw('testparam=testvalue', t('Query parameter added to menu link.'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue