Shrinked variable names to prevent travis build script from breaking.

This commit is contained in:
Christian Bünte 2014-02-18 15:15:32 +01:00
parent 7530becfb0
commit 36f7d011da

17
code/forms/LanguageDropdownField.php Executable file → Normal file
View File

@ -121,12 +121,21 @@ class LanguageDropdownField extends GroupedDropdownField {
function getURLForTranslationAndLocale($request) {
$id = (int)$request->requestVar('id');
$class = Convert::raw2sql($request->requestVar('class'));
$requestedLocale = Convert::raw2sql($request->requestVar('requestedLocale'));
$locale = Convert::raw2sql($request->requestVar('requestedLocale'));
$url = '';
if ($id && $class && class_exists($class) && $class::has_extension('Translatable')) {
if(($record = $class::get()->byId($id)) && ($translation = $record->getTranslations($requestedLocale)->First())) {
$controller = $translation instanceOf SiteTree ? singleton('CMSPageEditController') : Controller::curr();
$url = Controller::join_links($controller->Link('show'), $translation->ID, '?locale=' . $translation->Locale);
if(($record = $class::get()->byId($id)) && ($translation = $record->getTranslations($locale)->First())) {
$controller = $translation instanceOf SiteTree
? singleton('CMSPageEditController')
: Controller::curr();
$url = Controller::join_links(
$controller->Link('show'),
$translation->ID,
'?locale=' . $translation->Locale
);
}
}
return $url;