mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 09:05:59 +00:00
Shrinked variable names to prevent travis build script from breaking.
This commit is contained in:
parent
7530becfb0
commit
36f7d011da
17
code/forms/LanguageDropdownField.php
Executable file → Normal file
17
code/forms/LanguageDropdownField.php
Executable file → Normal 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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user