i18n for CMS section titles (see #7798)

This commit is contained in:
Ingo Schommer 2012-08-26 23:13:42 +02:00
parent 3b592122fd
commit 2fab657fce

View File

@ -336,9 +336,8 @@ class LeftAndMain extends Controller implements PermissionProvider {
} }
function handleRequest(SS_HTTPRequest $request, DataModel $model = null) { function handleRequest(SS_HTTPRequest $request, DataModel $model = null) {
$title = $this->Title();
$response = parent::handleRequest($request, $model); $response = parent::handleRequest($request, $model);
$title = $this->Title();
if(!$response->getHeader('X-Controller')) $response->addHeader('X-Controller', $this->class); if(!$response->getHeader('X-Controller')) $response->addHeader('X-Controller', $this->class);
if(!$response->getHeader('X-Title')) $response->addHeader('X-Title', $title); if(!$response->getHeader('X-Title')) $response->addHeader('X-Title', $title);
@ -1342,8 +1341,10 @@ class LeftAndMain extends Controller implements PermissionProvider {
* @return string * @return string
*/ */
function SectionTitle() { function SectionTitle() {
if($title = $this->stat('menu_title')) return $title; $class = get_class($this);
$defaultTitle = LeftAndMain::menu_title_for_class($class);
if($title = _t("{$class}.MENUTITLE", $defaultTitle)) return $title;
foreach($this->MainMenu() as $menuItem) { foreach($this->MainMenu() as $menuItem) {
if($menuItem->LinkingMode != 'link') return $menuItem->Title; if($menuItem->LinkingMode != 'link') return $menuItem->Title;
} }