- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/classes/general/prop_element_auto.php
- Класс: CIBlockPropertyElementAutoComplete
- Вызов: CIBlockPropertyElementAutoComplete::PrepareSettings
static function PrepareSettings($arFields)
{
/*
* VIEW - view type
* SHOW_ADD - show button for add new values in linked iblock
* MAX_WIDTH - max width textarea and input in pixels
* MIN_HEIGHT - min height textarea in pixels
* MAX_HEIGHT - max height textarea in pixels
* BAN_SYM - banned symbols string
* REP_SYM - replace symbol
* OTHER_REP_SYM - non standart replace symbol
* IBLOCK_MESS - get lang mess from linked iblock
*/
$arViewsList = static::GetPropertyViewsList(false);
$strView = (isset($arFields['USER_TYPE_SETTINGS']['VIEW']) && in_array($arFields['USER_TYPE_SETTINGS']['VIEW'],$arViewsList) ? $arFields['USER_TYPE_SETTINGS']['VIEW'] : current($arViewsList));
$strShowAdd = ($arFields['USER_TYPE_SETTINGS']['SHOW_ADD'] ?? '');
$strShowAdd = ($strShowAdd == 'Y' ? 'Y' : 'N');
if ((int)($arFields['LINK_IBLOCK_ID'] ?? 0) <= 0)
$strShowAdd = 'N';
$intMaxWidth = (int)($arFields['USER_TYPE_SETTINGS']['MAX_WIDTH'] ?? 0);
if ($intMaxWidth <= 0) $intMaxWidth = 0;
$intMinHeight = (int)($arFields['USER_TYPE_SETTINGS']['MIN_HEIGHT'] ?? 0);
if ($intMinHeight <= 0) $intMinHeight = 24;
$intMaxHeight = (int)($arFields['USER_TYPE_SETTINGS']['MAX_HEIGHT'] ?? 0);
if ($intMaxHeight <= 0) $intMaxHeight = 1000;
$strBannedSymbols = trim((string)($arFields['USER_TYPE_SETTINGS']['BAN_SYM'] ?? ',;'));
$strBannedSymbols = str_replace(' ', '', $strBannedSymbols);
if (mb_strpos($strBannedSymbols, ',') === false)
$strBannedSymbols .= ',';
if (mb_strpos($strBannedSymbols, ';') === false)
$strBannedSymbols .= ';';
$strOtherReplaceSymbol = '';
$strReplaceSymbol = ($arFields['USER_TYPE_SETTINGS']['REP_SYM'] ?? ' ');
if ($strReplaceSymbol == BT_UT_AUTOCOMPLETE_REP_SYM_OTHER)
{
$strOtherReplaceSymbol = (isset($arFields['USER_TYPE_SETTINGS']['OTHER_REP_SYM'])? mb_substr($arFields['USER_TYPE_SETTINGS']['OTHER_REP_SYM'], 0, 1) : '');
if ((',' == $strOtherReplaceSymbol) || (';' == $strOtherReplaceSymbol))
$strOtherReplaceSymbol = '';
if (('' == $strOtherReplaceSymbol) || in_array($strOtherReplaceSymbol, static::GetReplaceSymList()))
{
$strReplaceSymbol = $strOtherReplaceSymbol;
$strOtherReplaceSymbol = '';
}
}
if ('' == $strReplaceSymbol)
{
$strReplaceSymbol = ' ';
$strOtherReplaceSymbol = '';
}
$strIBlockMess = ($arFields['USER_TYPE_SETTINGS']['IBLOCK_MESS'] ?? '');
if ('Y' != $strIBlockMess) $strIBlockMess = 'N';
return [
'VIEW' => $strView,
'SHOW_ADD' => $strShowAdd,
'MAX_WIDTH' => $intMaxWidth,
'MIN_HEIGHT' => $intMinHeight,
'MAX_HEIGHT' => $intMaxHeight,
'BAN_SYM' => $strBannedSymbols,
'REP_SYM' => $strReplaceSymbol,
'OTHER_REP_SYM' => $strOtherReplaceSymbol,
'IBLOCK_MESS' => $strIBlockMess,
];
}