mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUGFIX Resetting Translatable locale in SearchForm after querying - this was causing side-effects when running TranslatableSearchFormTest in combination with other Translatable tests
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75922 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
681380424a
commit
1fdf655db8
@ -105,6 +105,7 @@ class SearchForm extends Form {
|
||||
|
||||
// set language (if present)
|
||||
if(singleton('SiteTree')->hasExtension('Translatable') && isset($data['locale'])) {
|
||||
$origLocale = Translatable::current_locale();
|
||||
Translatable::set_reading_locale($data['locale']);
|
||||
}
|
||||
|
||||
@ -135,6 +136,11 @@ class SearchForm extends Form {
|
||||
if(!$result->canView()) $results->remove($result);
|
||||
}
|
||||
|
||||
// reset locale
|
||||
if(singleton('SiteTree')->hasExtension('Translatable') && isset($data['locale'])) {
|
||||
Translatable::set_reading_locale($origLocale);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user