mirror of
https://github.com/silverstripe/silverstripe-widgets
synced 2024-10-22 17:05:54 +02:00
Merge pull request #8 from creamarketing/editable-widgetarea-translatable
BUG: set current locale when fetching editable widget segment
This commit is contained in:
commit
4efe3e65be
@ -211,6 +211,12 @@ class Widget_Controller extends Controller {
|
|||||||
*/
|
*/
|
||||||
function editablesegment() {
|
function editablesegment() {
|
||||||
$className = $this->urlParams['ID'];
|
$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')) {
|
if(class_exists($className) && is_subclass_of($className, 'Widget')) {
|
||||||
$obj = new $className();
|
$obj = new $className();
|
||||||
return $obj->EditableSegment();
|
return $obj->EditableSegment();
|
||||||
|
Loading…
Reference in New Issue
Block a user