CCrmViewHelper::RenderSelector

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CCrmViewHelper
  4. RenderSelector
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_view_helper.php
  • Класс: \CCrmViewHelper
  • Вызов: CCrmViewHelper::RenderSelector
static function RenderSelector($arParams)
{
	if(!is_array($arParams))
	{
		return;
	}

	$value = isset($arParams['VALUE']) ? $arParams['VALUE'] : '';
	//Items must be html encoded
	$items = isset($arParams['ITEMS']) ? $arParams['ITEMS'] : array();
	$encodeItems = isset($arParams['ENCODE_ITEMS']) ? (bool)$arParams['ENCODE_ITEMS'] : true;
	$resultItems = array();
	foreach($items as $id => $caption)
	{
		$resultItems[] = array(
			'id' => $id,
			'caption' => !$encodeItems ? $caption : htmlspecialcharsbx($caption)
		);
	}

	$text =  $value !== '' && isset($items[$value]) ? $items[$value] : '';

	if($text === '')
	{
		$text = isset($arParams['UNDEFINED']) ? htmlspecialcharsbx($arParams['UNDEFINED']) : '';
	}

	$editable = isset($arParams['EDITABLE']) ? $arParams['EDITABLE'] : false;
	if($editable)
	{
		$selectorName = isset($arParams['SELECTOR_ID']) ? $arParams['SELECTOR_ID'] : 'selector';
		$fieldID = isset($arParams['FIELD_ID']) ? $arParams['FIELD_ID'] : '';
		//$containerID = isset($arParams['CONTAINER_ID']) ? $arParams['CONTAINER_ID'] : 'sidebar';

		$containerClassName = isset($arParams['CONTAINER_CLASS']) ? $arParams['CONTAINER_CLASS'] : '';
		echo '';

		$uniqueID = uniqid();

		$itemID = "{$selectorName}_{$uniqueID}";
		$textClassName = isset($arParams['TEXT_CLASS']) ? $arParams['TEXT_CLASS'] : '';
		echo '', $text, '';

		$buttonID = '';
		$arrowClassName = isset($arParams['ARROW_CLASS']) ? $arParams['ARROW_CLASS'] : '';
		if($arrowClassName !== '')
		{
			$buttonID = "{$selectorName}_btn_{$uniqueID}";
			echo '';
		}

		echo '';

		echo '';
	}
	else
	{
		echo htmlspecialcharsbx($text);
	}
}

Добавить комментарий