• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/basetype/select.php
  • Класс: BitrixBizprocBaseTypeSelect
  • Вызов: Select::renderControl
static function renderControl(FieldType $fieldType, array $field, $value, $allowSelection, $renderMode)
{
	$selectorValue = null;
	$typeValue = [];
	if (!is_array($value))
	{
		$value = (array)$value;
	}

	if (CBPHelper::isAssociativeArray($value))
	{
		$value = array_keys($value);
	}

	foreach ($value as $v)
	{
		if ($allowSelection && CBPActivity::isExpression($v))
		{
			$selectorValue = $v;
		}
		else
		{
			$typeValue[] = (string)$v;
		}
	}

	// need to show at least one control
	if (empty($typeValue))
	{
		$typeValue[] = null;
	}

	$className = static::generateControlClassName($fieldType, $field);
	$selectorAttributes = '';

	$isPublicControl = $renderMode & FieldType::RENDER_MODE_PUBLIC;

	if ($allowSelection && $isPublicControl)
	{
		$selectorAttributes = sprintf(
			'data-role="inline-selector-target" data-property="%s" ',
			htmlspecialcharsbx(MainWebJson::encode($fieldType->getProperty()))
		);
	}

	if ($fieldType->isMultiple())
	{
		$selectorAttributes .= 'size="5" multiple ';
	}

	$renderResult = sprintf(
		'';

	if ($allowSelection && !$isPublicControl)
	{
		$renderResult .= static::renderControlSelector($field, $selectorValue, true, '', $fieldType);
	}

	return $renderResult;
}