- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/classes/general/mobile_helper.php
- Класс: \CCrmMobileHelper
- Вызов: CCrmMobileHelper::getVisibleUserFields
private function getVisibleUserFields(array $userFields, ?string $scopePrefix): array
{
$visibleUserFields = [];
if(
!empty($scopePrefix)
&&
Loader::includeModule('ui')
&&
count($userFields)
)
{
$configScope = CUserOptions::GetOption(
self::USER_OPTION_CATEGORY,
"{$scopePrefix}_scope",
EntityEditorConfigScope::UNDEFINED
);
$config = [];
if(isset($configScope['scope']) && $configScope['scope'] === EntityEditorConfigScope::UNDEFINED)
{
$config = CUserOptions::GetOption(
self::USER_OPTION_CATEGORY,
$scopePrefix,
null
);
if(!is_array($config) || empty($config))
{
$config = CUserOptions::GetOption(
self::USER_OPTION_CATEGORY,
"{$scopePrefix}_common",
null,
0
);
}
}
elseif(isset($configScope['scope']) && $configScope['scope'] === EntityEditorConfigScope::COMMON)
{
$config = CUserOptions::GetOption(
self::USER_OPTION_CATEGORY,
"{$scopePrefix}_common",
null,
0
);
}
elseif(isset($configScope['scope']) && $configScope['scope'] === EntityEditorConfigScope::CUSTOM)
{
$config = Scope::getInstance()->getScopeById($configScope['userScopeId']);
}
if (!is_array($config) || empty($config))
{
$config = CUserOptions::GetOption(
self::USER_OPTION_CATEGORY,
$scopePrefix,
null
);
}
if($config && count($config))
{
$this->prepareVisibleUserFieldsSection($config, $userFields, $visibleUserFields);
}
}
if (!count($visibleUserFields))
{
return [[
'id' => 'main',
'fields' => $userFields
]];
}
return $visibleUserFields;
}