Added check to see if the DataObject actually has translation before iterating over.

This commit is contained in:
Gus King 2013-10-14 01:56:07 -04:00
parent 242acac7dd
commit e5b95f9bb2

View File

@ -1071,7 +1071,8 @@ class Translatable extends DataExtension implements PermissionProvider {
));
if (!$tab->fieldByName('existingtrans')) {
$existingTransHTML = '<ul>';
foreach($this->getTranslations() as $existingTranslation) {
if ($existingTranslations = $this->getTranslations()) {
foreach ($existingTranslations as $existingTranslation) {
if ($existingTranslation && $existingTranslation->hasMethod('CMSEditLink')) {
$existingTransHTML .= sprintf(
'<li><a href="%s">%s</a></li>',
@ -1083,6 +1084,7 @@ class Translatable extends DataExtension implements PermissionProvider {
);
}
}
}
$existingTransHTML .= '</ul>';
$tab->push(new LiteralField('existingtrans', $existingTransHTML));
}