• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/hook/page/settings.php
  • Класс: BitrixLandingHookPageSettings
  • Вызов: Settings::getFieldByType
static function getFieldByType($type, $code, $params = array())
{
	$field = null;

	switch ($type)
	{
		case 'LIST':
			{
				$field = new FieldSelect($code, array(
					'title' => isset($params['NAME'])
								? $params['NAME']
								: '',
					'options' => isset($params['VALUES'])
								? (array) $params['VALUES']
								: array(),
					'multiple' => isset($params['MULTIPLE'])
									&& $params['MULTIPLE'] == 'Y'
				));
				break;
			}
		case 'CHECKBOX':
			{
				$field = new FieldCheckbox($code, array(
					'title' => isset($params['NAME'])
						? $params['NAME']
						: ''
				));
				break;
			}
		default:
			{
				$field = new FieldText($code, array(
					'title' => isset($params['NAME'])
						? $params['NAME']
						: ''
				));
				break;
			}
	}

	if ($field && isset(self::getDefaultValues()[$code]))
	{
		$field->setValue(self::getDefaultValues()[$code]);
	}

	return $field;
}