mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
keep the previous code as it is and return in if condition
This commit is contained in:
parent
7bed02e286
commit
014f05a5f0
@ -1731,20 +1731,20 @@ class Translatable extends DataExtension implements PermissionProvider
|
|||||||
&& count($controller->getRequest()->getVars())
|
&& count($controller->getRequest()->getVars())
|
||||||
) {
|
) {
|
||||||
$tags .= '<link rel="canonical" href="'.$controller->AbsoluteLink().'" />';
|
$tags .= '<link rel="canonical" href="'.$controller->AbsoluteLink().'" />';
|
||||||
} else {
|
return;
|
||||||
$template = '<link rel="alternate" type="text/html" title="%s" hreflang="%s" href="%s" />' . "\n";
|
}
|
||||||
$translations = $this->owner->getTranslations();
|
$template = '<link rel="alternate" type="text/html" title="%s" hreflang="%s" href="%s" />' . "\n";
|
||||||
if($translations->count()) {
|
$translations = $this->owner->getTranslations();
|
||||||
$translations = $translations->toArray();
|
if($translations->count()) {
|
||||||
$translations[] = $this->owner;
|
$translations = $translations->toArray();
|
||||||
|
$translations[] = $this->owner;
|
||||||
|
|
||||||
foreach($translations as $translation) {
|
foreach($translations as $translation) {
|
||||||
$tags .= sprintf($template,
|
$tags .= sprintf($template,
|
||||||
Convert::raw2xml($translation->Title),
|
Convert::raw2xml($translation->Title),
|
||||||
i18n::convert_rfc1766($translation->Locale),
|
i18n::convert_rfc1766($translation->Locale),
|
||||||
$translation->AbsoluteLink()
|
$translation->AbsoluteLink()
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user