mirror of
https://github.com/silverstripe/silverstripe-translatable
synced 2024-10-22 11:05:59 +02:00
FIX: getTranslations should not change the locale-filter-state
If the locale-filter was disabled before calling the method, it would be enabled after calling getTranslations, this commit now only re-enabled the locale-filter if it was enabled before calling the method...
This commit is contained in:
parent
fb15dae253
commit
9579748e13
@ -1166,7 +1166,13 @@ class Translatable extends DataExtension implements PermissionProvider {
|
||||
if($this->owner->exists()) {
|
||||
// HACK need to disable language filtering in augmentSQL(),
|
||||
// as we purposely want to get different language
|
||||
// also save state of locale-filter, revert to this state at the
|
||||
// end of this method
|
||||
$localeFilterEnabled = false;
|
||||
if(self::locale_filter_enabled()) {
|
||||
self::disable_locale_filter();
|
||||
$localeFilterEnabled = true;
|
||||
}
|
||||
|
||||
$translationGroupID = $this->getTranslationGroup();
|
||||
|
||||
@ -1196,7 +1202,10 @@ class Translatable extends DataExtension implements PermissionProvider {
|
||||
->leftJoin("{$baseDataClass}_translationgroups", $joinOnClause);
|
||||
}
|
||||
|
||||
// only re-enable locale-filter if it was enabled at the beginning of this method
|
||||
if($localeFilterEnabled) {
|
||||
self::enable_locale_filter();
|
||||
}
|
||||
|
||||
return $translations;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user