Merge pull request #1467 from open-sausages/pulls/4.0/menu-title-override

API set menu title without editing transifex masters
This commit is contained in:
Ingo Schommer 2016-05-02 22:10:20 +12:00
commit ba2c84109c
2 changed files with 11 additions and 2 deletions

View File

@ -599,8 +599,17 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider{
return $items; 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() { public function providePermissions() {
$title = _t("AssetAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class)); $title = static::menu_title();
return array( return array(
"CMS_ACCESS_AssetAdmin" => array( "CMS_ACCESS_AssetAdmin" => array(
'name' => _t('CMSMain.ACCESS', "Access to '{title}' section", array('title' => $title)), '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() { public function providePermissions() {
$title = _t("CMSPagesController.MENUTITLE", LeftAndMain::menu_title_for_class('CMSPagesController')); $title = CMSPagesController::menu_title();
return array( return array(
"CMS_ACCESS_CMSMain" => array( "CMS_ACCESS_CMSMain" => array(
'name' => _t('CMSMain.ACCESS', "Access to '{title}' section", array('title' => $title)), 'name' => _t('CMSMain.ACCESS', "Access to '{title}' section", array('title' => $title)),