...Человеческий поиск в разработке...
- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_view_helper.php
- Класс: \CCrmViewHelper
- Вызов: CCrmViewHelper::PrepareMultiFieldHtml
static function PrepareMultiFieldHtml($typeName, $arParams, $arOptions = array()) { $value = isset($arParams['VALUE']) ? $arParams['VALUE'] : ''; $valueUrl = $value; if($typeName === 'PHONE') { if($value === '') { return isset($arOptions['STUB']) ? $arOptions['STUB'] : ''; } $valueUrl = \Bitrix\Main\PhoneNumber\Parser::getInstance()->parse($value)->format(); $additionalHtml = ''; $enableSip = is_array($arOptions) && isset($arOptions['ENABLE_SIP']) && (bool)$arOptions['ENABLE_SIP']; if($enableSip) { $sipParams = isset($arOptions['SIP_PARAMS']) ? $arOptions['SIP_PARAMS'] : null; $additionalHtml = self::PrepareSipCallHtml($value, $sipParams); } $linkAttrs = CCrmCallToUrl::PrepareLinkAttributes($value, isset($arOptions['SIP_PARAMS']) ? $arOptions['SIP_PARAMS'] : array()); $className = isset($arParams['CLASS_NAME']) ? $arParams['CLASS_NAME'] : 'crm-client-contacts-block-text-tel'; return '' .htmlspecialcharsbx($valueUrl).''.$additionalHtml; } elseif($typeName === 'EMAIL') { if($value === '') { return isset($arOptions['STUB']) ? $arOptions['STUB'] : ''; } $crmEmail = mb_strtolower(trim(COption::GetOptionString('crm', 'mail', ''))); if($crmEmail !== '') { $valueUrl = $valueUrl.'?cc='.urlencode($crmEmail); } $className = isset($arParams['CLASS_NAME']) ? $arParams['CLASS_NAME'] : 'crm-client-contacts-block-text-tel'; return '' .htmlspecialcharsbx($value).''; } elseif($typeName === 'WEB') { if($value === '') { return isset($arOptions['STUB']) ? $arOptions['STUB'] : ''; } $valueUrl = preg_replace('/^\s*http(s)?:\/\//i', '', $value); } $valueTypeID = isset($arParams['VALUE_TYPE_ID']) ? $arParams['VALUE_TYPE_ID'] : ''; $valueType = isset($arParams['VALUE_TYPE']) ? $arParams['VALUE_TYPE'] : null; if($typeName === 'IM') { $linkAttrs = OpenLineManager::prepareMultiFieldLinkAttributes($typeName, $valueTypeID, $value); if(is_array($linkAttrs)) { $className = isset($arParams['CLASS_NAME']) ? $arParams['CLASS_NAME'] : 'crm-client-contacts-block-text-tel'; return '' .htmlspecialcharsbx($linkAttrs['TEXT']).''; } } if(!$valueType && $valueTypeID !== '') { $arEntityTypes = CCrmFieldMulti::GetEntityTypes(); $arValueTypes = isset($arEntityTypes[$typeName]) ? $arEntityTypes[$typeName] : array(); $valueType = isset($arValueTypes[$valueTypeID]) ? $arValueTypes[$valueTypeID] : null; } if(!($valueType && !empty($valueType['TEMPLATE']))) { if($value === '') { return isset($arOptions['STUB']) ? $arOptions['STUB'] : ''; } return htmlspecialcharsbx($value); } if($value === '') { return isset($arOptions['STUB']) ? $arOptions['STUB'] : ''; } $template = $valueType['TEMPLATE']; //HACK: Crutch for https protocol support. if($typeName === 'WEB' && ($valueTypeID === 'HOME' || $valueTypeID === 'WORK' || $valueTypeID = 'OTHER') && preg_match('/^\s*https:\/\//i', $value) === 1) { $template = preg_replace('/http:\/\//i', 'https://', $template); } return str_replace( array( '#VALUE#', '#VALUE_URL#', '#VALUE_HTML#' ), array( $value, htmlspecialcharsbx($valueUrl), htmlspecialcharsbx($value) ), $template ); }