Completed
Push — master ( 593040...ceb694 )
by Kristijan
27s queued 10s
created

helpers.php ➔ errorBlockPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
use Kris\LaravelFormBuilder\Fields\FormField;
4
use Kris\LaravelFormBuilder\Form;
5
6
7
if(!function_exists('errorBlockPath'))
8
{
9
10
    function errorBlockPath()
11
    {
12
        return __DIR__.'/views/errors.php';
13
    }
14
15
}
16
17
if(!function_exists('helpBlockPath'))
18
{
19
20
    function helpBlockPath()
21
    {
22
        return __DIR__.'/views/help_block.php';
23
    }
24
25
}
26
27
if (!function_exists('form')) {
28
29
    function form(Form $form, array $options = [])
30
    {
31
        return $form->renderForm($options);
32
    }
33
34
}
35
36
if (!function_exists('form_start')) {
37
38
    function form_start(Form $form, array $options = [])
39
    {
40
        return $form->renderForm($options, true, false, false);
41
    }
42
43
}
44
45
if (!function_exists('form_end')) {
46
47
    function form_end(Form $form, $showFields = true)
48
    {
49
        return $form->renderRest(true, $showFields);
50
    }
51
52
}
53
54
if (!function_exists('form_rest')) {
55
56
    function form_rest(Form $form)
57
    {
58
        return $form->renderRest(false);
59
    }
60
61
}
62
63
if (!function_exists('form_until')) {
64
65
    function form_until(Form $form, $field_name)
66
    {
67
        return $form->renderUntil($field_name, false);
68
    }
69
70
}
71
72
if (!function_exists('form_row')) {
73
74
    function form_row(FormField $formField, array $options = [])
75
    {
76
        return $formField->render($options);
77
    }
78
79
}
80
81
if (!function_exists('form_rows')) {
82
    function form_rows(Form $form, array $fields, array $options = [])
83
    {
84
        return implode(array_map(function($field) use ($form, $options) {
85
            return $form->has($field) ? $form->getField($field)->render($options) : '';
86
        }, $fields));
87
    }
88
}
89
90
if (!function_exists('form_label')) {
91
92
    function form_label(FormField $formField, array $options = [])
93
    {
94
        return $formField->render($options, true, false, false);
95
    }
96
97
}
98
99
if (!function_exists('form_widget')) {
100
101
    function form_widget(FormField $formField, array $options = [])
102
    {
103
        return $formField->render($options, false, true, false);
104
    }
105
106
}
107
108
if (!function_exists('form_errors')) {
109
110
    function form_errors(FormField $formField, array $options = [])
111
    {
112
        return $formField->render($options, false, false, true);
113
    }
114
115
}
116
117
if (!function_exists('form_fields')) {
118
119
    function form_fields(Form $form, array $options = [])
120
    {
121
        return $form->renderForm($options, false, true, false);
122
    }
123
124
}
125