Completed
Push — master ( a94554...39eef4 )
by Costin
02:09
created

Input::setDefaultClass()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SoareCostin\BladeFormComponents\FormElements;
4
5
use SoareCostin\BladeFormComponents\FormElement;
6
7
class Input extends FormElement
8
{
9
    /** @var string */
10
    public $type = 'text';
11
12
    /** @var string */
13
    public $placeholder;
14
15
    protected function attributesList()
16
    {
17
        return [
18
            'id', 'name', 'type', 'placeholder', 'value', 'class', 'required', 'disabled', 'readonly', 'autocomplete',
19
        ];
20
    }
21
22
    protected function setSpecificAttributes()
23
    {
24
        $this->setPlaceholder();
25
        $this->setType();
26
    }
27
28
    protected function setPlaceholder()
29
    {
30
        if (isset($this->params['placeholder']) && ! empty($this->params['placeholder'])) {
31
            $this->placeholder = $this->params['placeholder'];
32
        }
33
    }
34
35
    protected function setType()
36
    {
37
        if (isset($this->params['type']) && ! empty($this->params['type'])) {
38
            $this->type = $this->params['type'];
39
        }
40
    }
41
42
    protected function setDefaultClass()
43
    {
44
        $this->class[] = config('blade-form-components.themes.'.$this->getTheme().'.fields.input');
45
    }
46
}
47