public static function extractValue(FieldType $fieldType, array $field, array $request)
 {
     if (!Loader::includeModule('disk')) {
         return null;
     }
     $value = parent::extractValue($fieldType, $field, $request);
     if (isset($value['VALUE'])) {
         $value = $value['VALUE'];
     }
     if (!$value) {
         return null;
     }
     // Attach file disk
     $userFieldManager = \Bitrix\Disk\Driver::getInstance()->getUserFieldManager();
     list($connectorClass, $moduleId) = $userFieldManager->getConnectorDataByEntityType('iblock_workflow');
     list($type, $realId) = \Bitrix\Disk\Uf\FileUserType::detectType($value);
     if ($type != \Bitrix\Disk\Uf\FileUserType::TYPE_NEW_OBJECT) {
         return null;
     }
     $errorCollection = new \Bitrix\Disk\Internals\Error\ErrorCollection();
     $fileModel = \Bitrix\Disk\File::loadById($realId, array('STORAGE'));
     if (!$fileModel) {
         return null;
     }
     $securityContext = $fileModel->getStorage()->getCurrentUserSecurityContext();
     if (!$fileModel->canRead($securityContext)) {
         return null;
     }
     $documentType = $fieldType->getDocumentType();
     $iblockId = intval(substr($documentType[2], strlen("iblock_")));
     $canUpdate = $fileModel->canUpdate($securityContext);
     global $USER;
     $attachedModel = \Bitrix\Disk\AttachedObject::add(array('MODULE_ID' => $moduleId, 'OBJECT_ID' => $fileModel->getId(), 'ENTITY_ID' => $iblockId, 'ENTITY_TYPE' => $connectorClass, 'IS_EDITABLE' => (int) $canUpdate, 'ALLOW_EDIT' => (int) ($canUpdate && (int) \Bitrix\Main\Application::getInstance()->getContext()->getRequest()->getPost('DISK_FILE_' . $iblockId . '_DISK_ATTACHED_OBJECT_ALLOW_EDIT')), 'CREATED_BY' => $USER->getId()), $errorCollection);
     if (!$attachedModel || $errorCollection->hasErrors()) {
         return null;
     }
     return $attachedModel->getId();
 }
 /**
  * @param FieldType $fieldType
  * @param array $field
  * @param array $request
  * @return null|mixed
  */
 protected static function extractValue(FieldType $fieldType, array $field, array $request)
 {
     $value = parent::extractValue($fieldType, $field, $request);
     if ($value !== null && !static::isCompatibleMode()) {
         $value = "user_" . $value;
     }
     return $value;
 }
 public static function extractValue(FieldType $fieldType, array $field, array $request)
 {
     $value = parent::extractValue($fieldType, $field, $request);
     if (is_array($value) && isset($value['VALUE'])) {
         $value = $value['VALUE'];
     }
     if (!$value) {
         return null;
     }
     $property = static::getUserType($fieldType);
     $iblockId = self::getIblockId($fieldType);
     if (array_key_exists('AttachFilesWorkflow', $property)) {
         return call_user_func_array($property['AttachFilesWorkflow'], array($iblockId, $value));
     }
     return null;
 }