keep the previous code as it is and return in if condition

This commit is contained in:
Priyashantha 2018-06-05 18:03:12 +05:30 committed by GitHub
parent 7bed02e286
commit 014f05a5f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1731,20 +1731,20 @@ class Translatable extends DataExtension implements PermissionProvider
&& count($controller->getRequest()->getVars())
) {
$tags .= '<link rel="canonical" href="'.$controller->AbsoluteLink().'" />';
} else {
$template = '<link rel="alternate" type="text/html" title="%s" hreflang="%s" href="%s" />' . "\n";
$translations = $this->owner->getTranslations();
if($translations->count()) {
$translations = $translations->toArray();
$translations[] = $this->owner;
return;
}
$template = '<link rel="alternate" type="text/html" title="%s" hreflang="%s" href="%s" />' . "\n";
$translations = $this->owner->getTranslations();
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()
);
}
}
}