Passed
Pull Request — 2.x (#1360)
by Harings
14:11
created

Medias::render()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace A17\Twill\View\Components;
4
5
class Medias extends TwillFormComponent
6
{
7
    public $max;
8
    public $required;
9
    public $note;
10
    public $fieldNote;
11
    public $withAddInfo;
12
    public $withVideoUrl;
13
    public $withCaption;
14
    public $altTextMaxLength;
15
    public $captionMaxLength;
16
    public $extraMetadatas;
17
    public $widthMin;
18
    public $heightMin;
19
    public $buttonOnTop;
20
    public $activeCrop;
21
22
    public function __construct(
23
        $name,
24
        $label,
25
        $renderForBlocks = false,
26
        $renderForModal = false,
27
        $max = 1,
28
        $required = false,
29
        $note = null,
30
        $fieldNote = null,
31
        $withAddInfo = true,
32
        $withVideoUrl = true,
33
        $withCaption = true,
34
        $altTextMaxLength = false,
35
        $captionMaxLength = false,
36
        $extraMetadatas = [],
37
        $widthMin = 0,
38
        $heightMin = 0,
39
        $buttonOnTop = false,
40
        $activeCrop = true
41
    )
42
    {
43
        parent::__construct($name, $label, $renderForBlocks, $renderForModal);
44
        $this->max = $max;
45
        $this->required = $required;
46
        $this->note = $note;
47
        $this->fieldNote = $fieldNote;
48
        $this->withAddInfo = $withAddInfo;
49
        $this->withVideoUrl = $withVideoUrl;
50
        $this->withCaption = $withCaption;
51
        $this->altTextMaxLength = $altTextMaxLength;
52
        $this->captionMaxLength = $captionMaxLength;
53
        $this->extraMetadatas = $extraMetadatas;
54
        $this->widthMin = $widthMin;
55
        $this->heightMin = $heightMin;
56
        $this->buttonOnTop = $buttonOnTop;
57
        $this->activeCrop = $activeCrop;
58
    }
59
60
    public function render()
61
    {
62
        return view('twill::partials.form._medias', [
63
            'multiple' => $this->max > 1 || $this->max === 0,
64
        ]);
65
    }
66
}
67