Passed
Push — master ( 5e4c5e...9eef8c )
by Bruno
07:32
created

Upload::getMetadata()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Formularium\Frontend\Materialize\Element;
4
5
use Formularium\Element;
6
use Formularium\HTMLNode;
7
use Formularium\Metadata;
8
use Formularium\Frontend\HTML\Element\Upload as HTMLUpload;
9
10
class Upload extends Element
11
{
12
    public function render(array $parameters, HTMLNode $previous): HTMLNode
13
    {
14
        return HTMLNode::factory(
15
            'div',
16
            [
17
                'class' => 'formularium-upload file-field input-field'
18
            ],
19
            [
20
                HTMLNode::factory(
21
                    'div',
22
                    [
23
                        'class' => 'btn',
24
                    ],
25
                    [
26
                        HTMLNode::factory(
27
                            'span',
28
                            [
29
                                'class' => 'formularium-label',
30
                            ],
31
                            $parameters[self::LABEL] ?? 'File'
32
                        ),
33
                        HTMLNode::factory(
34
                            'input',
35
                            [
36
                                'class' => 'formularium-input',
37
                                'type' => 'file'
38
                            ]
39
                        ),
40
                    ],
41
                ),
42
                HTMLNode::factory(
43
                    'div',
44
                    ['class' => 'file-path-wrapper'],
45
                    HTMLNode::factory(
46
                        'input',
47
                        [
48
                            'class' => 'file-path validate',
49
                            'type' => 'text'
50
                        ]
51
                    ),
52
                ),
53
            ]
54
        );
55
    }
56
57
    public static function getMetadata(): Metadata
58
    {
59
        $metadata = HTMLUpload::getMetadata();
60
        return $metadata;
61
    }
62
}
63