|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Hideyo\Ecommerce\Framework\Providers; |
|
4
|
|
|
|
|
5
|
|
|
use Html; |
|
6
|
|
|
use Form; |
|
|
|
|
|
|
7
|
|
|
|
|
8
|
|
|
class FormBuilder extends \Collective\Html\FormBuilder |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* delete ajax button |
|
12
|
|
|
* @param string $url |
|
13
|
|
|
* @param string $buttonLabel |
|
14
|
|
|
* @param array $formParameters |
|
15
|
|
|
* @param array $buttonOptions |
|
16
|
|
|
* @param boolean $title |
|
17
|
|
|
* @return object |
|
18
|
|
|
*/ |
|
19
|
|
|
public function deleteajax($url, $buttonLabel = 'Delete', $formParameters = array(), $buttonOptions = array(), $title = false) |
|
20
|
|
|
{ |
|
21
|
|
|
if (empty($formParameters)) { |
|
22
|
|
|
$formParameters = array( |
|
23
|
|
|
'method'=>'DELETE', |
|
24
|
|
|
'class' =>'delete-form delete-button', |
|
25
|
|
|
'url' =>$url, |
|
26
|
|
|
'style' => 'display:inline', |
|
27
|
|
|
'data-title' => $title |
|
28
|
|
|
); |
|
29
|
|
|
} else { |
|
30
|
|
|
$formParameters['url'] = $url; |
|
31
|
|
|
$formParameters['method'] = 'DELETE'; |
|
32
|
|
|
}; |
|
33
|
|
|
|
|
34
|
|
|
return Form::open($formParameters) |
|
|
|
|
|
|
35
|
|
|
. Form::submit($buttonLabel, $buttonOptions) |
|
36
|
|
|
. Form::close(); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* multi select2 |
|
41
|
|
|
* @param string $name |
|
42
|
|
|
* @param array $list |
|
43
|
|
|
* @param array $selected |
|
44
|
|
|
* @param array $options |
|
45
|
|
|
* @param string $placeholder |
|
46
|
|
|
* @return string |
|
47
|
|
|
*/ |
|
48
|
|
|
public function multiselect2($name, array $list = [], array $selected = [], $options = [], $placeholder = 'Select one...') |
|
|
|
|
|
|
49
|
|
|
{ |
|
50
|
|
|
$options['name'] = $name; |
|
51
|
|
|
$html = array(); |
|
52
|
|
|
if (is_array($selected)) { |
|
|
|
|
|
|
53
|
|
|
foreach ($selected as $key => $value) { |
|
54
|
|
|
$selected[$value] = $value; |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
//dd($list, $selected); |
|
59
|
|
|
foreach ($list as $value => $display) { |
|
60
|
|
|
$sel = isset($selected[$value])?' selected="selected"':''; |
|
61
|
|
|
$html[] = '<option value="'.$value.'"'.$sel.'>'.e($display).'</option>'; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
// build out a final select statement, which will contain all the values. |
|
65
|
|
|
$options = Html::attributes($options); |
|
66
|
|
|
$list = ""; |
|
67
|
|
|
|
|
68
|
|
|
if ($html) { |
|
69
|
|
|
$list = implode('', $html); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
return "<select multiple {$options} class=\"select2 form-control\">{$list}</select>"; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* select2 |
|
77
|
|
|
* @param string $name |
|
78
|
|
|
* @param array $list |
|
79
|
|
|
* @param [type] $selected |
|
|
|
|
|
|
80
|
|
|
* @param array $options |
|
81
|
|
|
* @param string $placeholder |
|
82
|
|
|
* @return string |
|
83
|
|
|
*/ |
|
84
|
|
|
public function select2($name, array $list = [], $selected, $options = [], $placeholder = 'Select one...') |
|
|
|
|
|
|
85
|
|
|
{ |
|
86
|
|
|
$options['name'] = $name; |
|
87
|
|
|
$html = array(); |
|
88
|
|
|
|
|
89
|
|
|
foreach ($list as $value => $display) { |
|
90
|
|
|
$sel = ''; |
|
91
|
|
|
if ($selected == $value) { |
|
92
|
|
|
$sel = ' selected="selected"'; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
$html[] = '<option value="'.$value.'"'.$sel.'>'.e($display).'</option>'; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
// build out a final select statement, which will contain all the values. |
|
99
|
|
|
$options = HTML::attributes($options); |
|
100
|
|
|
$list = ""; |
|
101
|
|
|
if ($html) { |
|
102
|
|
|
$list = implode('', $html); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
return "<select {$options} class=\"select2 form-control\">{$list}</select>"; |
|
106
|
|
|
} |
|
107
|
|
|
} |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths