- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/integration/filediskproperty.php
- Класс: BitrixDiskIntegrationFileDiskProperty
- Вызов: FileDiskProperty::getPublicEditHTML
static function getPublicEditHTML($property, $value, $controlSettings)
{
global $APPLICATION;
$value['VALUE'] = self::prepareValue($value);
$fieldName = isset($controlSettings['VALUE']) ? $controlSettings['VALUE'] : '';
$fieldDescription = isset($controlSettings['DESCRIPTION']) ? $controlSettings['DESCRIPTION'] : '';
$userFieldManager = Driver::getInstance()->getUserFieldManager();
list($connectorClass, $moduleId) = $userFieldManager->getConnectorDataByEntityType("iblock_workflow");
foreach($value['VALUE'] as $idKey => $id)
{
$attachedModel = AttachedObject::loadById($id);
if(!$attachedModel)
{
$fileModel = File::loadById($id, array('STORAGE'));
if($fileModel)
{
$attachedModel = AttachedObject::load(array(
'OBJECT_ID' => $fileModel->getId(),
'=ENTITY_TYPE' => $connectorClass,
'=ENTITY_ID' => $property['IBLOCK_ID'],
'=MODULE_ID' => $moduleId
));
if ($attachedModel)
{
$value['VALUE'][$idKey] = $attachedModel->getId();
}
else
{
$value['VALUE'][$idKey] = FileUserType::NEW_FILE_PREFIX.$id;
}
}
}
}
$userField = array(
'ENTITY_ID' => 'DISK_FILE_'.$property['IBLOCK_ID'],
'FIELD_NAME' => $fieldName,
'USER_TYPE_ID' => 'disk_file',
'SORT' => 100,
'MULTIPLE' => 'Y',
'MANDATORY' => $property['IS_REQUIRED'],
'EDIT_IN_LIST' => 'Y',
'EDIT_FORM_LABEL' => $fieldDescription,
'VALUE' => $value['VALUE'],
'USER_TYPE' => $property['PROPERTY_USER_TYPE']
);
ob_start();
$APPLICATION->includeComponent(
'bitrix:system.field.edit',
'disk_file',
array(
'arUserField' => $userField,
'HIDE_SELECT_DIALOG' => 'Y',
'HIDE_CHECKBOX_ALLOW_EDIT' => 'Y',
'bVarsFromForm' => true,
'form_name' => $controlSettings['FORM_NAME'],
'FILE_SHOW_POPUP' => true,
'DISABLE_MOD_ZIP' => 'Y'
),
false,
array('HIDE_ICONS' => 'Y')
);
$html = ob_get_contents();
ob_end_clean();
return $html;
}