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
2dff101b45
commit
4c3d97537e
@ -1165,8 +1165,15 @@ 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
|
||||
self::disable_locale_filter();
|
||||
|
||||
// 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();
|
||||
|
||||
$baseDataClass = ClassInfo::baseDataClass($this->owner->class);
|
||||
@ -1195,7 +1202,11 @@ class Translatable extends DataExtension implements PermissionProvider {
|
||||
->leftJoin("{$baseDataClass}_translationgroups", $joinOnClause);
|
||||
}
|
||||
|
||||
self::enable_locale_filter();
|
||||
// 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