From 6eadbbff7f75fd1b1b138cb6fc4bc3f4b1b87004 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 4 Nov 2008 01:46:58 +0000 Subject: [PATCH] ENHANCEMENT Updated LeftAndMain->getMenuTitle() to use classname as fallback if $menu_title is not defined - one less thing to specify in a minimalist ModelAdmin subclass git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@65181 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/LeftAndMain.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index f1b449a0..e971e8cb 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -254,12 +254,13 @@ class LeftAndMain extends Controller { } /** - * Override {@link getMenuTitle} in child classes to make the menu title translatable for that class + * Override {@link getMenuTitle} in child classes to make the menu title translatable for that class. + * Uses {@link $menu_title} if present, otherwise falls back to the classname without the "Admin" suffix. * * @return string */ public function getMenuTitle() { - return $this->stat('menu_title'); + return ($this->stat('menu_title')) ? $this->stat('menu_title') : preg_replace('/Admin$/', '', $this->class); } public function show($params) {