From 27208655b974ef0958708edbbfc1305f20d4368b Mon Sep 17 00:00:00 2001 From: Simon Elvery Date: Fri, 4 Jan 2013 09:22:46 +1000 Subject: [PATCH] ENHANCEMENT Don't show translations dropdown if all translations have been created. --- code/model/Translatable.php | 14 +++++++++++++- lang/en.yml | 3 ++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/code/model/Translatable.php b/code/model/Translatable.php index 83f3481..910e251 100755 --- a/code/model/Translatable.php +++ b/code/model/Translatable.php @@ -989,11 +989,23 @@ class Translatable extends DataExtension implements PermissionProvider { ) ); $createButton->includeDefaultJS(false); + + if ( count($langDropdown->getSource()) < 1 ) { + $fields->insertAfter( + new LiteralField( + 'AllTransCreated', + _t('Translatable.ALLCREATED', 'All allowed translations have been created.') + ), + 'CreateTransHeader' + ); + $fields->removeByName('NewTransLang'); + $fields->removeByName('createtranslation'); + } if($alreadyTranslatedLocales) { $fields->addFieldToTab( 'Root.Translations', - new HeaderField('ExistingTransHeader', _t('Translatable.EXISTING', 'Existing translations:'), 3) + new HeaderField('ExistingTransHeader', _t('Translatable.EXISTING', 'Existing translations'), 3) ); $existingTransHTML = '