From 4324d5b607c9ab1306deacc54aecc51e75d1403e Mon Sep 17 00:00:00 2001 From: Michal Kleiner Date: Thu, 4 Aug 2016 16:32:17 +1200 Subject: [PATCH 1/2] Output extra meta tags only when there are any existing translations --- code/model/Translatable.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/model/Translatable.php b/code/model/Translatable.php index c52e607..310e982 100755 --- a/code/model/Translatable.php +++ b/code/model/Translatable.php @@ -1574,7 +1574,7 @@ class Translatable extends DataExtension implements PermissionProvider { function MetaTags(&$tags) { $template = '' . "\n"; $translations = $this->owner->getTranslations(); - if($translations) { + if($translations->count()) { $translations = $translations->toArray(); $translations[] = $this->owner; From 7f34bac485362201eedc181d3b492dac2d480e1e Mon Sep 17 00:00:00 2001 From: Michal Kleiner Date: Thu, 4 Aug 2016 16:32:59 +1200 Subject: [PATCH 2/2] Adjust block indentation --- code/model/Translatable.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/model/Translatable.php b/code/model/Translatable.php index 310e982..3ef7594 100755 --- a/code/model/Translatable.php +++ b/code/model/Translatable.php @@ -1577,12 +1577,12 @@ class Translatable extends DataExtension implements PermissionProvider { if($translations->count()) { $translations = $translations->toArray(); $translations[] = $this->owner; - - foreach($translations as $translation) { - $tags .= sprintf($template, - Convert::raw2xml($translation->Title), - i18n::convert_rfc1766($translation->Locale), - $translation->AbsoluteLink() + + foreach($translations as $translation) { + $tags .= sprintf($template, + Convert::raw2xml($translation->Title), + i18n::convert_rfc1766($translation->Locale), + $translation->AbsoluteLink() ); } }