• Модуль: rest
  • Путь к файлу: ~/bitrix/modules/rest/lib/preset/data/element.php
  • Класс: BitrixRestPresetDataElement
  • Вызов: Element::get
static function get($code) : array
{
	$result = [];
	$cache = Cache::createInstance();
	if ($cache->initCache(static::CACHE_TIME, 'item_' . $code . LANGUAGE_ID, static::CACHE_DIR))
	{
		$result = $cache->getVars();
	}
	elseif ($cache->startDataCache())
	{
		$remoteDictionary = new Integration();
		$dictionary = $remoteDictionary->toArray();
		if (!empty($dictionary))
		{
			$dictionaryCode = array_column($dictionary, 'code');
			$key = array_search($code, $dictionaryCode, true);
			if ($key !== false)
			{
				$el = $dictionary[$key];
				if (!empty($el['option']))
				{
					$data = Json::decode(base64_decode($el['option']));
					if (is_array($data))
					{
						$data = static::changeMessage($data);
						$data['CODE'] = $data['ELEMENT_CODE'];
						$result = $data;
					}
				}
			}
		}
		if (empty($result) && !empty(static::DEFAULT_DATA[$code]))
		{
			$result = static::changeMessage(static::DEFAULT_DATA[$code]);
		}

		$cache->endDataCache($result);
	}

	return $result;
}