• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/uf/fileusertype.php
  • Класс: BitrixDiskUfFileUserType
  • Вызов: FileUserType::getValueForAllowEdit
static function getValueForAllowEdit(array $userField, $id): ?bool
{
	if (isset(self::$valuesAllowEditByEntityType[$userField['ENTITY_ID']]))
	{
		return self::$valuesAllowEditByEntityType[$userField['ENTITY_ID']];
	}

	$userFieldManager = Driver::getInstance()->getUserFieldManager();

	$entityType = $userField['ENTITY_ID'];
	$postValue = Application::getInstance()->getContext()->getRequest()->getPost(
		$userFieldManager->getInputNameForAllowEditByEntityType($entityType)
	);

	// Live Feed disguises forums comments as social network comments.
	// When you add a new comment for a task/event,
	// Live Feed creates a forum message and then creates a log entry.
	// see CSocNetLogComments::Add,
	// see CSocNetLogTools::AddComment_Tasks, CSocNetLogTools::AddComment_Forum
	if ($postValue === null && ($entityType === 'FORUM_MESSAGE' || $entityType === 'SONET_COMMENT'))
	{
		$entityType = $entityType === 'FORUM_MESSAGE' ? 'SONET_COMMENT' : 'FORUM_MESSAGE';
		$postValue = Application::getInstance()->getContext()->getRequest()->getPost(
			$userFieldManager->getInputNameForAllowEditByEntityType($entityType)
		);
	}

	if ($postValue === null)
	{
		return null;
	}
	else if (is_array($postValue))
	{
		if (isset($postValue[$id]) && is_string($postValue[$id]))
		{
			return (bool)$postValue[$id];
		}
		else
		{
			return null;
		}
	}
	else
	{
		return (bool)$postValue;
	}
}