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:
Ingo Schommer 2009-05-04 02:51:33 +00:00
parent 681380424a
commit 1fdf655db8

View File

@ -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;
}