• Модуль: ui
  • Путь к файлу: ~/bitrix/modules/ui/lib/entityform/scope.php
  • Класс: BitrixUiEntityFormScope
  • Вызов: Scope::setScopeToUser
protected function setScopeToUser(
	string $categoryName,
	string $guid,
	string $scope,
	int $userScopeId,
	?int $userId = null
): void
{
	$scope = (isset($scope) ? strtoupper($scope) : EntityEditorConfigScope::UNDEFINED);

	if (EntityEditorConfigScope::isDefined($scope))
	{
		if ($scope === EntityEditorConfigScope::CUSTOM && $userScopeId)
		{
			$value = [
				'scope' => $scope,
				'userScopeId' => $userScopeId
			];
		}
		else
		{
			$value = $scope;
		}

		$userId = ($userId ?? false);
		CUserOptions::SetOption($categoryName, "{$guid}_scope", $value, false, $userId);
	}
}