• Модуль: lists
  • Путь к файлу: ~/bitrix/modules/lists/lib/field.php
  • Класс: BitrixListsField
  • Вызов: Field::prepareEditFieldByTypeG
static function prepareEditFieldByTypeG(array $field)
{
	if($field['IS_REQUIRED'] == 'Y')
		$items = array();
	else
		$items = array('' => Loc::getMessage('LISTS_FIELD_NO_VALUE'));

	$queryObject = CIBlockSection::getTreeList(array('IBLOCK_ID' => $field['LINK_IBLOCK_ID']));
	while($section = $queryObject->getNext())
		$items[$section['ID']] = str_repeat(' . ', $section['DEPTH_LEVEL']).$section['~NAME'];

	$inputName = $field['FIELD_ID'];
	if($field['MULTIPLE'] == 'Y')
	{
		$inputName .= '[]';
		$params = array('size' => 5, 'multiple' => 'multiple');
	}
	else
	{
		$params = array();
	}
	if($field['READ'] == 'Y')
		$params["disabled"] = 'disabled';

	if(!is_array($field['VALUE']))
		$field['VALUE'] = array($field['VALUE']);

	$result = array(
		'id' => $inputName,
		'name' => $field['NAME'],
		'required' => $field['IS_REQUIRED'] == 'Y' ? true : false,
		'type' => 'list',
		'show' => $field['SHOW'],
		'value' => $field['VALUE'],
		'items' => $items,
		'params' => $params
	);

	if($field['READ'] == 'Y')
	{
		foreach($field['VALUE'] as $value)
			$result['customHtml'] .= '';
	}

	return $result;
}