1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace JeroenNoten\LaravelAdminLte\View\Components\Form; |
4
|
|
|
|
5
|
|
|
class InputFile extends InputGroupComponent |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* The placeholder for the input file box. |
9
|
|
|
* |
10
|
|
|
* @var string |
11
|
|
|
*/ |
12
|
|
|
public $placeholder; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* A legend for replace the default 'Browse' text. |
16
|
|
|
* |
17
|
|
|
* @var string |
18
|
|
|
*/ |
19
|
|
|
public $legend; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Create a new component instance. |
23
|
|
|
* Note this component requires the 'bs-custom-input-file' plugin. |
24
|
|
|
* |
25
|
|
|
* @return void |
26
|
|
|
*/ |
27
|
2 |
|
public function __construct( |
28
|
|
|
$name, $id = null, $label = null, $igroupSize = null, $labelClass = null, |
29
|
|
|
$fgroupClass = null, $igroupClass = null, $disableFeedback = null, |
30
|
|
|
$errorKey = null, $placeholder = '', $legend = null |
31
|
|
|
) { |
32
|
2 |
|
parent::__construct( |
33
|
2 |
|
$name, $id, $label, $igroupSize, $labelClass, $fgroupClass, |
34
|
|
|
$igroupClass, $disableFeedback, $errorKey |
35
|
|
|
); |
36
|
|
|
|
37
|
2 |
|
$this->legend = $legend; |
38
|
2 |
|
$this->placeholder = $placeholder; |
39
|
2 |
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Make the class attribute for the input group item. |
43
|
|
|
* |
44
|
|
|
* @return string |
45
|
|
|
*/ |
46
|
1 |
|
public function makeItemClass() |
47
|
|
|
{ |
48
|
1 |
|
$classes = ['custom-file-input']; |
49
|
|
|
|
50
|
1 |
|
if ($this->isInvalid() && ! isset($this->disableFeedback)) { |
51
|
1 |
|
$classes[] = 'is-invalid'; |
52
|
|
|
} |
53
|
|
|
|
54
|
1 |
|
return implode(' ', $classes); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Get the view / contents that represent the component. |
59
|
|
|
* |
60
|
|
|
* @return \Illuminate\View\View|string |
61
|
|
|
*/ |
62
|
1 |
|
public function render() |
63
|
|
|
{ |
64
|
1 |
|
return view('adminlte::components.form.input-file'); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|