API set menu title without editing transifex masters

This commit is contained in:
Damian Mooyman 2016-05-02 10:42:47 +12:00 committed by Ingo Schommer
parent 7534d75789
commit 46f69b0c0d
2 changed files with 11 additions and 2 deletions

View File

@ -599,8 +599,17 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider{
return $items;
}
public static function menu_title($class = null, $localised = true) {
// Deprecate this menu title if installed alongside new asset admin
if($localised && class_exists('SilverStripe\AssetAdmin\Controller\AssetAdmin')) {
// Don't conflict with legacy translations
return _t('AssetAdmin.CMSMENU_OLD', 'Files (old)');
}
return parent::menu_title(null, $localised);
}
public function providePermissions() {
$title = _t("AssetAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class));
$title = static::menu_title();
return array(
"CMS_ACCESS_AssetAdmin" => array(
'name' => _t('CMSMain.ACCESS', "Access to '{title}' section", array('title' => $title)),

View File

@ -1428,7 +1428,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
}
public function providePermissions() {
$title = _t("CMSPagesController.MENUTITLE", LeftAndMain::menu_title_for_class('CMSPagesController'));
$title = CMSPagesController::menu_title();
return array(
"CMS_ACCESS_CMSMain" => array(
'name' => _t('CMSMain.ACCESS', "Access to '{title}' section", array('title' => $title)),