mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
FIX: Rename search locale variable to avoid conflicts with locale switcher.
Fixes http://open.silverstripe.org/ticket/6204
This commit is contained in:
parent
d766af542d
commit
7c68414fe7
@ -43,7 +43,7 @@ class SearchForm extends Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable')) {
|
if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable')) {
|
||||||
$fields->push(new HiddenField('locale', 'locale', Translatable::get_current_locale()));
|
$fields->push(new HiddenField('searchlocale', 'searchlocale', Translatable::get_current_locale()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$actions) {
|
if(!$actions) {
|
||||||
@ -101,11 +101,18 @@ class SearchForm extends Form {
|
|||||||
if(!isset($data) || !is_array($data)) $data = $_REQUEST;
|
if(!isset($data) || !is_array($data)) $data = $_REQUEST;
|
||||||
|
|
||||||
// set language (if present)
|
// set language (if present)
|
||||||
if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable') && isset($data['locale'])) {
|
if(class_exists('Translatable')) {
|
||||||
$origLocale = Translatable::get_current_locale();
|
if(singleton('SiteTree')->hasExtension('Translatable') && isset($data['searchlocale'])) {
|
||||||
Translatable::set_current_locale($data['locale']);
|
if($data['searchlocale'] == "ALL") {
|
||||||
|
Translatable::disable_locale_filter();
|
||||||
|
} else {
|
||||||
|
$origLocale = Translatable::get_current_locale();
|
||||||
|
|
||||||
|
Translatable::set_current_locale($data['searchlocale']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$keywords = $data['Search'];
|
$keywords = $data['Search'];
|
||||||
|
|
||||||
$andProcessor = create_function('$matches','
|
$andProcessor = create_function('$matches','
|
||||||
@ -137,8 +144,14 @@ class SearchForm extends Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset locale
|
// reset locale
|
||||||
if(class_exists('Translatable') && singleton('SiteTree')->hasExtension('Translatable') && isset($data['locale'])) {
|
if(class_exists('Translatable')) {
|
||||||
Translatable::set_current_locale($origLocale);
|
if(singleton('SiteTree')->hasExtension('Translatable') && isset($data['searchlocale'])) {
|
||||||
|
if($data['searchlocale'] == "ALL") {
|
||||||
|
Translatable::enable_locale_filter();
|
||||||
|
} else {
|
||||||
|
Translatable::set_current_locale($origLocale);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
|
Loading…
Reference in New Issue
Block a user