#215858 by pwolanin: localized menu options were saved into the database, avoid this by using different variable names / array keys
parent
38332f801e
commit
39d28bd43e
|
@ -480,6 +480,7 @@ function _menu_check_access(&$item, $map) {
|
|||
*/
|
||||
function _menu_item_localize(&$item, $map, $link_translate = FALSE) {
|
||||
$callback = $item['title_callback'];
|
||||
$item['localized_options'] = $item['options'];
|
||||
// If we are not doing link translation or if the title matches the
|
||||
// link title of its router item, localize it.
|
||||
if (!$link_translate || (!empty($item['title']) && ($item['title'] == $item['link_title']))) {
|
||||
|
@ -502,7 +503,7 @@ function _menu_item_localize(&$item, $map, $link_translate = FALSE) {
|
|||
}
|
||||
// Avoid calling check_plain again on l() function.
|
||||
if ($callback == 'check_plain') {
|
||||
$item['options']['html'] = TRUE;
|
||||
$item['localized_options']['html'] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +516,7 @@ function _menu_item_localize(&$item, $map, $link_translate = FALSE) {
|
|||
$original_description = $item['description'];
|
||||
$item['description'] = t($item['description']);
|
||||
if ($link_translate && $item['options']['attributes']['title'] == $original_description) {
|
||||
$item['options']['attributes']['title'] = $item['description'];
|
||||
$item['localized_options']['attributes']['title'] = $item['description'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -619,7 +620,7 @@ function menu_tail_to_arg($arg, $map, $index) {
|
|||
* $item['href'] is generated from link_path, possibly by to_arg functions.
|
||||
* $item['title'] is generated from link_title, and may be localized.
|
||||
* $item['options'] is unserialized; it is also changed within the call here
|
||||
* to _menu_item_localize().
|
||||
* to $item['localized_options'] by _menu_item_localize().
|
||||
*/
|
||||
function _menu_link_translate(&$item) {
|
||||
$item['options'] = unserialize($item['options']);
|
||||
|
@ -1061,11 +1062,11 @@ function _menu_tree_data($result, $parents, $depth, $previous_element = '') {
|
|||
* @ingroup themeable
|
||||
*/
|
||||
function theme_menu_item_link($link) {
|
||||
if (empty($link['options'])) {
|
||||
$link['options'] = array();
|
||||
if (empty($link['localized_options'])) {
|
||||
$link['localized_options'] = array();
|
||||
}
|
||||
|
||||
return l($link['title'], $link['href'], $link['options']);
|
||||
return l($link['title'], $link['href'], $link['localized_options']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1216,7 +1217,7 @@ function menu_navigation_links($menu_name, $level = 0) {
|
|||
$links = array();
|
||||
foreach ($tree as $item) {
|
||||
if (!$item['link']['hidden']) {
|
||||
$l = $item['link']['options'];
|
||||
$l = $item['link']['localized_options'];
|
||||
$l['href'] = $item['link']['href'];
|
||||
$l['title'] = $item['link']['title'];
|
||||
// Keyed with unique menu id to generate classes from theme_links().
|
||||
|
@ -1442,7 +1443,7 @@ function menu_set_active_trail($new_trail = NULL) {
|
|||
}
|
||||
elseif (!isset($trail)) {
|
||||
$trail = array();
|
||||
$trail[] = array('title' => t('Home'), 'href' => '<front>', 'options' => array(), 'type' => 0);
|
||||
$trail[] = array('title' => t('Home'), 'href' => '<front>', 'localized_options' => array(), 'type' => 0);
|
||||
$item = menu_get_item();
|
||||
|
||||
// Check whether the current item is a local task (displayed as a tab).
|
||||
|
@ -1517,7 +1518,7 @@ function menu_get_active_breadcrumb() {
|
|||
$active_trail = menu_get_active_trail();
|
||||
|
||||
foreach ($active_trail as $parent) {
|
||||
$breadcrumb[] = l($parent['title'], $parent['href'], $parent['options']);
|
||||
$breadcrumb[] = l($parent['title'], $parent['href'], $parent['localized_options']);
|
||||
}
|
||||
$end = end($active_trail);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ function menu_overview_page() {
|
|||
$content = array();
|
||||
while ($menu = db_fetch_array($result)) {
|
||||
$menu['href'] = 'admin/build/menu-customize/'. $menu['menu_name'];
|
||||
$menu['options'] = array();
|
||||
$menu['localized_options'] = array();
|
||||
$content[] = $menu;
|
||||
}
|
||||
return theme('admin_block_content', $content);
|
||||
|
@ -29,7 +29,7 @@ function menu_overview_page() {
|
|||
function menu_overview_form(&$form_state, $menu) {
|
||||
global $menu_admin;
|
||||
$sql = "
|
||||
SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, ml.*
|
||||
SELECT m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, m.description, ml.*
|
||||
FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path
|
||||
WHERE ml.menu_name = '%s'
|
||||
ORDER BY p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC";
|
||||
|
@ -69,7 +69,7 @@ function _menu_overview_tree_form($tree) {
|
|||
$mlid = 'mlid:'. $item['mlid'];
|
||||
$form[$mlid]['#item'] = $item;
|
||||
$form[$mlid]['#attributes'] = $item['hidden'] ? array('class' => 'menu-disabled') : array('class' => 'menu-enabled');
|
||||
$form[$mlid]['title']['#value'] = l($item['title'], $item['href'], $item['options']) . ($item['hidden'] ? ' ('. t('disabled') .')' : '');
|
||||
$form[$mlid]['title']['#value'] = l($item['title'], $item['href'], $item['localized_options']) . ($item['hidden'] ? ' ('. t('disabled') .')' : '');
|
||||
$form[$mlid]['hidden'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#default_value' => !$item['hidden'],
|
||||
|
|
|
@ -35,8 +35,8 @@ function system_main_admin_page($arg = NULL) {
|
|||
}
|
||||
// The link 'description' either derived from the hook_menu 'description'
|
||||
// or entered by the user via menu module is saved as the title attribute.
|
||||
if (!empty($item['options']['attributes']['title'])) {
|
||||
$item['description'] = $item['options']['attributes']['title'];
|
||||
if (!empty($item['localized_options']['attributes']['title'])) {
|
||||
$item['description'] = $item['localized_options']['attributes']['title'];
|
||||
}
|
||||
$block = $item;
|
||||
$block['content'] = '';
|
||||
|
@ -1856,18 +1856,14 @@ function theme_admin_block_content($content) {
|
|||
if (system_admin_compact_mode()) {
|
||||
$output = '<ul class="menu">';
|
||||
foreach ($content as $item) {
|
||||
if (empty($item['attributes'])) {
|
||||
$item['attributes'] = array();
|
||||
}
|
||||
$item['attributes'] += array('title' => $item['description']);
|
||||
$output .= '<li class="leaf">'. l($item['title'], $item['href'], $item['options']) .'</li>';
|
||||
$output .= '<li class="leaf">'. l($item['title'], $item['href'], $item['localized_options']) .'</li>';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
}
|
||||
else {
|
||||
$output = '<dl class="admin-list">';
|
||||
foreach ($content as $item) {
|
||||
$output .= '<dt>'. l($item['title'], $item['href'], $item['options']) .'</dt>';
|
||||
$output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
|
||||
$output .= '<dd>'. $item['description'] .'</dd>';
|
||||
}
|
||||
$output .= '</dl>';
|
||||
|
|
|
@ -629,8 +629,8 @@ function system_admin_menu_block($item) {
|
|||
}
|
||||
// The link 'description' either derived from the hook_menu 'description' or
|
||||
// entered by the user via menu module is saved as the title attribute.
|
||||
if (!empty($item['options']['attributes']['title'])) {
|
||||
$item['description'] = $item['options']['attributes']['title'];
|
||||
if (!empty($item['localized_options']['attributes']['title'])) {
|
||||
$item['description'] = $item['localized_options']['attributes']['title'];
|
||||
}
|
||||
// Prepare for sorting as in function _menu_tree_check_access().
|
||||
// The weight is offset so it is always positive, with a uniform 5-digits.
|
||||
|
|
Loading…
Reference in New Issue