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
This commit is contained in:
Ingo Schommer 2008-11-04 01:46:58 +00:00
parent f2bf599795
commit 6eadbbff7f

View File

@ -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) {