Passed
Pull Request — master (#1022)
by Diego
02:37
created

Select2::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace JeroenNoten\LaravelAdminLte\View\Components\Form;
4
5
class Select2 extends InputGroupComponent
6
{
7
    use Traits\OldValueSupportTrait;
8
9
    /**
10
     * The select2 plugin configuration parameters. Array with key => value
11
     * pairs, where the key should be an existing configuration property of
12
     * the select2 plugin.
13
     *
14
     * @var array
15
     */
16
    public $config;
17
18
    /**
19
     * Create a new component instance.
20
     * Note this component requires the 'select2' plugin and the 'bootstrap4'
21
     * css theme.
22
     *
23
     * @return void
24
     */
25 3
    public function __construct(
26
        $name, $id = null, $label = null, $igroupSize = null, $labelClass = null,
27
        $fgroupClass = null, $igroupClass = null, $disableFeedback = null,
28
        $errorKey = null, $config = [], $enableOldSupport = null
29
    ) {
30 3
        parent::__construct(
31 3
            $name, $id, $label, $igroupSize, $labelClass, $fgroupClass,
32
            $igroupClass, $disableFeedback, $errorKey
33
        );
34
35 3
        $this->config = is_array($config) ? $config : [];
36 3
        $this->config['theme'] = 'bootstrap4';
37 3
        $this->enableOldSupport = isset($enableOldSupport);
38 3
    }
39
40
    /**
41
     * Get the view / contents that represent the component.
42
     *
43
     * @return \Illuminate\View\View|string
44
     */
45 1
    public function render()
46
    {
47 1
        return view('adminlte::components.form.select2');
48
    }
49
}
50