-
Notifications
You must be signed in to change notification settings - Fork 554
/
Medias.php
62 lines (58 loc) · 1.7 KB
/
Medias.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
namespace A17\Twill\View\Components\Fields;
use Illuminate\Contracts\View\View;
class Medias extends TwillFormComponent
{
public function __construct(
string $name,
string $label,
bool $renderForBlocks = false,
bool $renderForModal = false,
bool $translated = false,
bool $required = false,
?string $note = '',
mixed $default = null,
bool $disabled = false,
bool $readOnly = false,
bool $inModal = false,
// Component specific
public int $max = 1,
public ?string $fieldNote = null,
public bool $withAddInfo = true,
public bool $withVideoUrl = true,
public bool $withCaption = true,
public ?int $altTextMaxLength = null,
public ?int $captionMaxLength = null,
public array $extraMetadatas = [],
public int $widthMin = 0,
public int $heightMin = 0,
public bool $buttonOnTop = false,
public bool $activeCrop = true
) {
parent::__construct(
name: $name,
label: $label,
note: $note,
inModal: $inModal,
readOnly: $readOnly,
renderForBlocks: $renderForBlocks,
renderForModal: $renderForModal,
disabled: $disabled,
required: $required,
translated: $translated,
default: $default
);
}
public function render(): View
{
return view(
'twill::partials.form._medias',
array_merge(
$this->data(),
[
'multiple' => $this->max > 1 || $this->max === 0,
]
)
);
}
}