Conditions | 5 |
Paths | 6 |
Total Lines | 30 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 5 |
Changes | 0 |
1 | <?php namespace Distilleries\FormBuilder\Fields; |
||
7 | 40 | public function view(array $options = [], $showLabel = true, $showField = true, $showError = false) |
|
8 | { |
||
9 | |||
10 | 40 | $this->rendered = true; |
|
11 | 40 | $options = $this->prepareOptions($options); |
|
12 | |||
13 | 40 | if (!$this->needsLabel($options)) |
|
14 | { |
||
15 | 8 | $showLabel = false; |
|
16 | } |
||
17 | |||
18 | 40 | if (!empty($options['noInEditView']) && $options['noInEditView'] === true) { |
|
19 | 2 | return ''; |
|
20 | } |
||
21 | |||
22 | 38 | if (isset($options['default_value'])) { |
|
23 | 12 | $options['value'] = $options['default_value']; |
|
24 | } |
||
25 | |||
26 | 38 | return $this->formHelper->getView()->make( |
|
27 | 38 | $this->template, [ |
|
28 | 38 | 'name' => $this->name, |
|
29 | 38 | 'type' => $this->type, |
|
30 | 38 | 'options' => $options, |
|
31 | 'noEdit' => true, |
||
32 | 38 | 'showLabel' => $showLabel, |
|
33 | 38 | 'showField' => $showField, |
|
34 | 38 | 'showError' => $showError |
|
35 | ]) |
||
36 | 38 | ->render(); |
|
37 | } |
||
38 | } |