21 if (static::$languageList ===
null)
23 static::$languageList = [
28 if (Main\Loader::includeModule(
'bitrix24'))
30 $licenseLang = \CBitrix24::getLicensePrefix();
34 $dbSites = \CSite::getList(
42 if ($site = $dbSites->fetch() && !empty($site[
'LANGUAGE_ID']))
44 $licenseLang = $site[
'LANGUAGE_ID'];
48 if($licenseLang ===
null)
50 $licenseLang = static::DEFAULT_LANG;
53 static::$languageList[] = $licenseLang;
56 return static::$languageList;
62 if (!empty($data[static::KEY_LANG_ALL]))
65 $langList = static::listLanguage();
66 foreach ($langList as $lang)
68 if (is_array($data[static::KEY_LANG_ALL][$lang]))
75 if ($useLang !==
false)
77 $result = $data[static::KEY_LANG_ALL][$useLang];
81 $item = reset($data[static::KEY_LANG_ALL]);
89 return array_merge($data, $result);
100 public static function fillCompatibility(array $param, array $fieldList, array $defaultValues = []) : array
104 $langList = static::listLanguage();
105 $langDefault = reset($langList);
107 if (empty($param[static::KEY_LANG_ALL]))
109 foreach ($fieldList as $key)
111 $value = trim($param[$key] ??
'');
114 $result[static::KEY_LANG_ALL][$langDefault][$key] = $value;
115 $result[$key] = trim($param[$key]);
117 elseif ($defaultValues[$key])
119 $result[static::KEY_LANG_ALL][$langDefault][$key] = $defaultValues[$key];
120 $result[$key] = $defaultValues[$key];
126 foreach ($param[static::KEY_LANG_ALL] as $langCode => $langItem)
128 foreach ($fieldList as $field)
130 $value = trim($langItem[$field] ??
'');
133 $result[static::KEY_LANG_ALL][$langCode][$field] = $value;
135 elseif ($defaultValues[$field])
137 $result[static::KEY_LANG_ALL][$langDefault][$field] = $defaultValues[$field];
141 $result = static::mergeFromLangAll($result);
144 if (empty($result[static::KEY_LANG_ALL]) && !empty($defaultValues))
146 $result[static::KEY_LANG_ALL][$langDefault] = $defaultValues;