public function getDescriptionEditorAction(string $editorId, int $epicId = 0): ?Component
{
if (!Loader::includeModule('disk'))
{
$this->errorCollection->setError(
new Error(
Loc::getMessage('TASKS_EC_ERROR_INCLUDE_MODULE_ERROR'),
self::ERROR_COULD_NOT_LOAD_MODULE
)
);
return null;
}
$epicService = new EpicService();
$description = '';
$epic = $epicService->getEpic($epicId);
if ($epic->getId())
{
$description = (new CBXSanitizer)->sanitizeHtml($epic->getDescription());
}
$buttons = ['UploadImage', 'UploadFile', 'CreateLink'];
$epicService = new EpicService();
$userFields = $epicService->getFilesUserField($this->userFieldManager, $epicId);
if ($epicService->getErrors())
{
$this->errorCollection->add($epicService->getErrors());
return null;
}
$fileField = $userFields['UF_SCRUM_EPIC_FILES'];
$params = [
'FORM_ID' => $editorId,
'SHOW_MORE' => 'N',
'PARSER' => [
'Bold', 'Italic', 'Underline', 'Strike', 'ForeColor', 'FontList', 'FontSizeList',
'RemoveFormat', 'Quote', 'Code', 'CreateLink', 'Image', 'Table', 'Justify',
'InsertOrderedList', 'InsertUnorderedList', 'SmileList', 'Source', 'UploadImage', 'MentionUser'
],
'BUTTONS' => $buttons,
'FILES' => [
'VALUE' => [],
'DEL_LINK' => '',
'SHOW' => 'N'
],
'TEXT' => [
'INPUT_NAME' => 'ACTION[0][ARGUMENTS][data][DESCRIPTION]',
'VALUE' => $description,
'HEIGHT' => '120px'
],
'PROPERTIES' => [],
'UPLOAD_FILE' => true,
'UPLOAD_WEBDAV_ELEMENT' => $fileField ?? false,
'UPLOAD_FILE_PARAMS' => ['width' => 400, 'height' => 400],
'NAME_TEMPLATE' => UtilSite::getUserNameFormat(),
'LHE' => [
'id' => $editorId,
'iframeCss' => 'body { padding-left: 10px !important; }',
'fontSize' => '14px',
'bInitByJS' => false,
'height' => 100,
'lazyLoad' => 'N',
'bbCode' => true,
]
];
return new Component('bitrix:main.post.form', '', $params);
}