Hidden::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 7
ccs 0
cts 6
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Rocket\UI\Forms\Fields;
3
4
/**
5
 * Manage hidden fields
6
 */
7
8
/**
9
 * Hidden field
10
 *
11
 * @author Stéphane Goetz
12
 */
13
class Hidden extends Field
14
{
15
    /**
16
     * Extends the type
17
     * @param string $id
18
     * @param array $data
19
     */
20
    public function __construct($id, $data = [])
21
    {
22
        $this->type = 'hidden';
23
        $this->show_label = false;
24
25
        parent::__construct($id, $data);
26
    }
27
28
    /**
29
     * Override the attributes to stay hidden
30
     */
31
    protected function inputAttributes()
32
    {
33
        $this->input_attributes['name'] = $this->name;
34
        $this->input_attributes['id'] = $this->id;
35
        $this->input_attributes['type'] = 'hidden';
36
    }
37
}
38