Check if object is folder before trying to add cms fields.

This commit is contained in:
3dgoo (Michael) 2016-07-28 13:37:22 +09:30
parent 9b2183167f
commit 0fea48a608

View File

@ -1065,6 +1065,7 @@ class Translatable extends DataExtension implements PermissionProvider {
$alreadyTranslatedLocales[$this->owner->Locale] = $this->owner->Locale;
$alreadyTranslatedLocales = array_combine($alreadyTranslatedLocales, $alreadyTranslatedLocales);
if ($fields->hasTabSet()) {
// Check if fields exist already to avoid adding them twice on repeat invocations
$tab = $fields->findOrMakeTab('Root.Translations', _t('Translatable.TRANSLATIONS', 'Translations'));
if(!$tab->fieldByName('CreateTransHeader')) {
@ -1132,6 +1133,7 @@ class Translatable extends DataExtension implements PermissionProvider {
}
}
}
}
function updateSettingsFields(&$fields) {
$this->addTranslatableFields($fields);