1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace JeroenNoten\LaravelAdminLte\View\Components\Form; |
4
|
|
|
|
5
|
|
|
class TextEditor extends InputGroupComponent |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* The Summernote plugin configuration parameters. Array with key => value |
9
|
|
|
* pairs, where the key should be an existing configuration property of |
10
|
|
|
* the plugin. |
11
|
|
|
* |
12
|
|
|
* @var array |
13
|
|
|
*/ |
14
|
|
|
public $config; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Create a new component instance. |
18
|
|
|
* Note this component requires the 'Summernote' plugin. |
19
|
|
|
* TODO: the append/prepend addon slots are not supported. |
20
|
|
|
* |
21
|
|
|
* @return void |
22
|
|
|
*/ |
23
|
2 |
|
public function __construct( |
24
|
|
|
$name, $id = null, $label = null, $igroupSize = null, $labelClass = null, |
25
|
|
|
$fgroupClass = null, $igroupClass = null, $disableFeedback = null, |
26
|
|
|
$errorKey = null, $config = [] |
27
|
|
|
) { |
28
|
2 |
|
parent::__construct( |
29
|
2 |
|
$name, $id, $label, $igroupSize, $labelClass, $fgroupClass, |
30
|
|
|
$igroupClass, $disableFeedback, $errorKey |
31
|
|
|
); |
32
|
|
|
|
33
|
2 |
|
$this->config = is_array($config) ? $config : []; |
34
|
|
|
|
35
|
|
|
// Setup the default plugin width option. |
36
|
|
|
|
37
|
2 |
|
$this->config['width'] = $this->config['width'] ?? 'inherit'; |
38
|
2 |
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Make the class attribute for the "input-group" element. Note we overwrite |
42
|
|
|
* the method of the parent class. |
43
|
|
|
* |
44
|
|
|
* @return string |
45
|
|
|
*/ |
46
|
1 |
|
public function makeInputGroupClass() |
47
|
|
|
{ |
48
|
1 |
|
$classes = ['input-group']; |
49
|
|
|
|
50
|
1 |
|
if (isset($this->size) && in_array($this->size, ['sm', 'lg'])) { |
51
|
1 |
|
$classes[] = "input-group-{$this->size}"; |
52
|
|
|
} |
53
|
|
|
|
54
|
1 |
|
if ($this->isInvalid() && ! isset($this->disableFeedback)) { |
55
|
1 |
|
$classes[] = 'adminlte-invalid-itegroup'; |
56
|
|
|
} |
57
|
|
|
|
58
|
1 |
|
if (isset($this->igroupClass)) { |
59
|
1 |
|
$classes[] = $this->igroupClass; |
60
|
|
|
} |
61
|
|
|
|
62
|
1 |
|
return implode(' ', $classes); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Get the view / contents that represent the component. |
67
|
|
|
* |
68
|
|
|
* @return \Illuminate\View\View|string |
69
|
|
|
*/ |
70
|
1 |
|
public function render() |
71
|
|
|
{ |
72
|
1 |
|
return view('adminlte::components.form.text-editor'); |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|