1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
uploadercontextgenerator.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Main\UserField\File;
4
5
use Bitrix\Main\UI\FileInputUtility;
6
7
class
UploaderContextGenerator
8
{
9
public
function
__construct
(
10
private
readonly
FileInputUtility
$fileInputUtility,
11
private
readonly
array
$userField
12
)
13
{
14
}
15
16
public
function
getContextInEditMode
(
string
$cid):
array
17
{
18
return
array_merge(
19
$this->getBaseOptions(),
20
[
21
'cid'
=> $cid,
22
]
23
);
24
}
25
26
public
function
getContextForFileInViewMode
(
int
$fileId):
array
27
{
28
return
array_merge(
29
$this->getBaseOptions(),
30
[
31
'signedFileId'
=> (
new
UploaderFileSigner
(
32
(
string
)($this->userField[
'ENTITY_ID'
] ??
''
),
33
(
string
)($this->userField[
'FIELD_NAME'
] ??
''
)
34
))->sign($fileId),
35
]
36
);
37
}
38
39
public
function
getControlId
(): string
40
{
41
return
$this->fileInputUtility->getUserFieldCid($this->userField);
42
}
43
44
private
function
getBaseOptions():
array
45
{
46
return
[
47
'id'
=> (int)($this->userField[
'ID'
] ?? 0),
48
'entityId'
=> (string)($this->userField[
'ENTITY_ID'
] ??
''
),
49
'fieldName'
=> (string)($this->userField[
'FIELD_NAME'
] ??
''
),
50
'multiple'
=> ($this->userField[
'MULTIPLE'
] ??
''
) ===
'Y'
,
51
];
52
}
53
}
Bitrix\Main\UI\FileInputUtility
Определения
fileinpututility.php:8
Bitrix\Main\UserField\File\UploaderContextGenerator
Определения
uploadercontextgenerator.php:8
Bitrix\Main\UserField\File\UploaderContextGenerator\getContextForFileInViewMode
getContextForFileInViewMode(int $fileId)
Определения
uploadercontextgenerator.php:26
Bitrix\Main\UserField\File\UploaderContextGenerator\getContextInEditMode
getContextInEditMode(string $cid)
Определения
uploadercontextgenerator.php:16
Bitrix\Main\UserField\File\UploaderContextGenerator\getControlId
getControlId()
Определения
uploadercontextgenerator.php:39
Bitrix\Main\UserField\File\UploaderContextGenerator\__construct
__construct(private readonly FileInputUtility $fileInputUtility, private readonly array $userField)
Определения
uploadercontextgenerator.php:9
Bitrix\Main\UserField\File\UploaderFileSigner
Определения
uploaderfilesigner.php:10
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
bitrix
modules
main
lib
userfield
file
uploadercontextgenerator.php
Создано системой
1.14.0