Merge pull request #6453 from colemanw/i18n
authorcolemanw <coleman@civicrm.org>
Sun, 9 Aug 2015 21:59:15 +0000 (17:59 -0400)
committercolemanw <coleman@civicrm.org>
Sun, 9 Aug 2015 21:59:15 +0000 (17:59 -0400)
CRM-15375 - Fix incorrect default language in i18n form

CRM/Core/I18n/Form.php

index df679e4ecf68d028ffc252e6c3760df99df0d25c..2b3170d2e4191b51e2e19cd4677bdef83fce679f 100644 (file)
@@ -75,17 +75,19 @@ class CRM_Core_I18n_Form extends CRM_Core_Form {
     }
     $required = !empty($widget['required']);
 
+    if ($widget['type'] == 'RichTextEditor') {
+      $widget['type'] = 'wysiwyg';
+      $attributes['class'] .= ' collapsed';
+    }
+
     $languages = CRM_Core_I18n::languages(TRUE);
     foreach ($this->_locales as $locale) {
+      $attr = $attributes;
       $name = "{$field}_{$locale}";
       if ($locale == $tsLocale) {
-        $attributes['class'] .= ' default-lang';
-      }
-      if ($widget['type'] == 'RichTextEditor') {
-        $attributes['class'] .= ' collapsed';
-        $widget['type'] = 'wysiwyg';
+        $attr['class'] .= ' default-lang';
       }
-      $this->add($widget['type'], $name, $languages[$locale], $attributes, $required);
+      $this->add($widget['type'], $name, $languages[$locale], $attr, $required);
 
       $this->_defaults[$name] = $dao->$locale;
     }