1003 public static function get($code) : array
1006 $cache = Cache::createInstance();
1007 if ($cache->initCache(static::CACHE_TIME,
'item_' . $code . LANGUAGE_ID, static::CACHE_DIR))
1009 $result = $cache->getVars();
1011 elseif ($cache->startDataCache())
1014 $dictionary = $remoteDictionary->toArray();
1015 if (!empty($dictionary))
1017 $dictionaryCode = array_column($dictionary,
'code');
1018 $key = array_search($code, $dictionaryCode,
true);
1021 $el = $dictionary[$key];
1022 if (!empty($el[
'option']))
1024 $data = Json::decode(base64_decode($el[
'option']));
1025 if (is_array($data))
1027 $data = static::changeMessage($data);
1028 $data[
'CODE'] = $data[
'ELEMENT_CODE'];
1034 if (empty($result) && !empty(static::DEFAULT_DATA[$code]))
1036 $result = static::changeMessage(static::DEFAULT_DATA[$code]);
1039 $cache->endDataCache($result);
1051 public static function getList($sectionCode) : array
1054 $cache = Cache::createInstance();
1055 if ($cache->initCache(static::CACHE_TIME,
'section_' . $sectionCode . LANGUAGE_ID, static::CACHE_DIR))
1057 $result = $cache->getVars();
1059 elseif ($cache->startDataCache())
1063 foreach ($dictionary as $el)
1065 if (!empty($el[
'option']))
1067 $data = Json::decode(base64_decode($el[
'option']));
1068 if (is_array($data) && $sectionCode === $data[
'SECTION_CODE'])
1070 $data = static::changeMessage($data);
1071 $data[
'CODE'] = $data[
'ELEMENT_CODE'];
1072 $result[$data[
'CODE']] = $data;
1079 foreach (static::DEFAULT_DATA as $data)
1081 if ($sectionCode === $data[
'SECTION_CODE'])
1083 $data = static::changeMessage($data);
1084 $result[$data[
'CODE']] = $data;
1089 $cache->endDataCache($result);