BUGFIX Setting menu titles for CMSMenu items in LeftAndMain::init() to get translated values for the current user locale (see #2873)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65106 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-11-02 22:45:49 +00:00
parent e1d5fc9db6
commit 386c586b38

View File

@ -329,8 +329,18 @@ class LeftAndMain extends Controller {
}
}
// already set in CMSMenu::populate_menu(), but from a static pre-controller
// context, so doesn't respect the current user locale in _t() calls - as a workaround,
// we simply call getMenuTitle() again if we're dealing with a controller
if($menuItem->controller) {
$controllerObj = singleton($menuItem->controller);
$title = $controllerObj->getMenuTitle();
} else {
$title = $menuItem->title;
}
$menu->push(new ArrayData(array(
"Title" => Convert::raw2xml($menuItem->title),
"Title" => Convert::raw2xml($title),
"Code" => $code,
"Link" => $menuItem->url,
"LinkingMode" => $linkingmode