Merge pull request #8 from creamarketing/editable-widgetarea-translatable

BUG: set current locale when fetching editable widget segment
This commit is contained in:
Mike Parkhill 2012-08-30 14:07:55 -07:00
commit 4efe3e65be

View File

@ -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();