• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/internals/input.php
  • Класс: Bitrix\Sale\Internals\Input\Base
  • Вызов: Base::getEditHtml
static function getEditHtml($name, array $input, $value = null)
{
	$name = htmlspecialcharsbx($name);

	$input['DISABLED'] ??= 'N';

	if ($value === null && isset($input['VALUE']))
	{
		$value = $input['VALUE'];
	}

	$html = '';

	if (isset($input['HIDDEN']) && ($input['HIDDEN'] === 'Y' || $input['HIDDEN'] === true))
	{
		$html .= static::getHiddenRecursive($name
			, (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y') ? static::asMultiple($value) : static::asSingle($value)
			, static::extractAttributes($input, array('DISABLED'=>''), array('FORM'=>''), false));
	}
	else
	{
		if (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y')
		{
			$tag = isset($input['MULTITAG']) ? htmlspecialcharsbx($input['MULTITAG']) : static::MULTITAG;
			[$startTag, $endTag] = $tag ? array("<$tag>", "") : array('', '');

			$index = -1;

			foreach (static::asMultiple($value) as $value)
			{
				$namix = $name.'['.(++$index).']';
				$html .= $startTag
					.static::getEditHtmlSingle($namix, $input, $value)
					.static::getEditHtmlSingleDelete($namix, $input)
					.$endTag;
			}

			$replace = '##INPUT##NAME##';

			if ($input['DISABLED'] !== 'Y') // TODO
				$html .= static::getEditHtmlInsert($tag, $replace, $name
					, static::getEditHtmlSingle($replace, $input, null).static::getEditHtmlSingleDelete($replace, $input)
					, static::getEditHtmlSingleAfterInsert());
		}
		else
		{
			$html .= static::getEditHtmlSingle($name, $input, static::asSingle($value));
		}
	}

	if (isset($input['ADDITIONAL_HIDDEN']) && $input['ADDITIONAL_HIDDEN'] === 'Y')
	{
		$html .= static::getHiddenRecursive($name
			, (isset($input['MULTIPLE']) && $input['MULTIPLE'] === 'Y') ? static::asMultiple($value) : static::asSingle($value)
			, static::extractAttributes($input, array(), array('FORM'=>''), false));
	}

	return $html;
}