mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
BUG: set current locale when fetching editable widget segment
Set the current locale before rendering the editable widget segment (if the Translatable module is installed)
This commit is contained in:
parent
2d58a9e351
commit
78bfae971d
@ -211,6 +211,12 @@ class Widget_Controller extends Controller {
|
||||
*/
|
||||
function editablesegment() {
|
||||
$className = $this->urlParams['ID'];
|
||||
if (class_exists('Translatable') && Member::currentUserID()) {
|
||||
// set current locale based on logged in user's locale
|
||||
$locale = Member::currentUser()->Locale;
|
||||
Translatable::set_current_locale($locale);
|
||||
i18n::set_locale($locale);
|
||||
}
|
||||
if(class_exists($className) && is_subclass_of($className, 'Widget')) {
|
||||
$obj = new $className();
|
||||
return $obj->EditableSegment();
|
||||
|
Loading…
Reference in New Issue
Block a user