Passed
Pull Request — 2.x (#1360)
by Harings
11:27
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
        $max = 1,
26
        $required = false,
27
        $note = null,
28
        $fieldNote = null,
29
        $withAddInfo = true,
30
        $withVideoUrl = true,
31
        $withCaption = true,
32
        $altTextMaxLength = false,
33
        $captionMaxLength = false,
34
        $extraMetadatas = [],
35
        $widthMin = 0,
36
        $heightMin = 0,
37
        $buttonOnTop = false,
38
        $activeCrop = true,
39
    )
40
    {
41
        parent::__construct($name, $label);
42
        $this->max = $max;
43
        $this->required = $required;
44
        $this->note = $note;
45
        $this->fieldNote = $fieldNote;
46
        $this->withAddInfo = $withAddInfo;
47
        $this->withVideoUrl = $withVideoUrl;
48
        $this->withCaption = $withCaption;
49
        $this->altTextMaxLength = $altTextMaxLength;
50
        $this->captionMaxLength = $captionMaxLength;
51
        $this->extraMetadatas = $extraMetadatas;
52
        $this->widthMin = $widthMin;
53
        $this->heightMin = $heightMin;
54
        $this->buttonOnTop = $buttonOnTop;
55
        $this->activeCrop = $activeCrop;
56
    }
57
58
    public function render()
59
    {
60
        return view('twill::partials.form._medias', [
61
            'multiple' => $this->max > 1 || $this->max === 0,
62
        ]);
63
    }
64
}
65