mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Added avoiding unhandled exception from Translatable extension in ContentController
This commit is contained in:
parent
b8e2b231ae
commit
68dd8cf798
@ -182,8 +182,9 @@ class ContentController extends Controller {
|
|||||||
// look for a translation and redirect (see #5001). Only happens on the last child in
|
// look for a translation and redirect (see #5001). Only happens on the last child in
|
||||||
// a potentially nested URL chain.
|
// a potentially nested URL chain.
|
||||||
if(class_exists('Translatable')) {
|
if(class_exists('Translatable')) {
|
||||||
if($request->getVar('locale') && $this->dataRecord && $this->dataRecord->Locale != $request->getVar('locale')) {
|
$locale = $request->getVar('locale');
|
||||||
$translation = $this->dataRecord->getTranslation($request->getVar('locale'));
|
if($locale && i18n::validate_locale($locale) && $this->dataRecord && $this->dataRecord->Locale != $locale) {
|
||||||
|
$translation = $this->dataRecord->getTranslation($locale);
|
||||||
if($translation) {
|
if($translation) {
|
||||||
$response = new SS_HTTPResponse();
|
$response = new SS_HTTPResponse();
|
||||||
$response->redirect($translation->Link(), 301);
|
$response->redirect($translation->Link(), 301);
|
||||||
|
Loading…
Reference in New Issue
Block a user