1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SleepingOwl\Admin\Factories; |
4
|
|
|
|
5
|
|
|
use SleepingOwl\Admin\AliasBinder; |
6
|
|
|
use SleepingOwl\Admin\Form\Columns; |
7
|
|
|
use SleepingOwl\Admin\Form\Element; |
8
|
|
|
use Illuminate\Database\Eloquent\Model; |
9
|
|
|
use SleepingOwl\Admin\Contracts\Form\FormElementFactoryInterface; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @method Element\Text text($name, $label = null) |
13
|
|
|
* @method Element\Image image($name, $label = null) |
14
|
|
|
* @method Element\Images images($name, $label = null) |
15
|
|
|
* @method Element\File file($name, $label = null) |
16
|
|
|
* @method Element\Time time($name, $label = null) |
17
|
|
|
* @method Element\Date date($name, $label = null) |
18
|
|
|
* @method Element\DateRange daterange($name, $label = null) |
19
|
|
|
* @method Element\Timestamp timestamp($name, $label = null) |
20
|
|
|
* @method Element\TextAddon textaddon($name, $label = null) |
21
|
|
|
* @method Element\Password password($name, $label = null) |
22
|
|
|
* @method Element\Select select($name, $label = null, array|Model $options) |
23
|
|
|
* @method Element\MultiSelect multiselect($name, $label = null, array|Model $options) |
24
|
|
|
* @method Columns\Columns columns(array $columns = []) |
25
|
|
|
* @method Columns\Columns column() |
26
|
|
|
* @method Element\Hidden hidden($name) |
27
|
|
|
* @method Element\Custom custom(\Closure $callback = null) |
28
|
|
|
* @method Element\Html html($html) |
29
|
|
|
* @method Element\View view($view, array $data, \Closure $callback = null) |
30
|
|
|
* @method Element\Checkbox checkbox($name, $label = null) |
31
|
|
|
* @method Element\CKEditor ckeditor($name, $label = null) |
32
|
|
|
* @method Element\Textarea textarea($name, $label = null) |
33
|
|
|
* @method Element\Radio radio($name, $label = null) |
34
|
|
|
* @method Element\Wysiwyg wysiwyg($name, $label = null, $editor = null) |
35
|
|
|
* @method Element\Upload upload($name, $label = null) |
36
|
|
|
* @method Element\Number number($name, $label = null) |
37
|
|
|
* @method Element\DependentSelect dependentselect($name, $label = null, array|Model $options) |
38
|
|
|
*/ |
39
|
|
|
class FormElementFactory extends AliasBinder implements FormElementFactoryInterface |
40
|
|
|
{ |
41
|
|
|
/** |
42
|
|
|
* FormElementFactory constructor. |
43
|
|
|
* |
44
|
|
|
* @param \Illuminate\Contracts\Foundation\Application $application |
45
|
|
|
*/ |
46
|
|
|
public function __construct(\Illuminate\Contracts\Foundation\Application $application) |
47
|
|
|
{ |
48
|
|
|
parent::__construct($application); |
49
|
|
|
|
50
|
|
|
$this->register([ |
51
|
|
|
'columns' => Columns\Columns::class, |
52
|
|
|
'column' => Columns\Column::class, |
53
|
|
|
'text' => Element\Text::class, |
54
|
|
|
'time' => Element\Time::class, |
55
|
|
|
'date' => Element\Date::class, |
56
|
|
|
'datetime' => Element\DateTime::class, |
57
|
|
|
'daterange' => Element\DateRange::class, |
58
|
|
|
'timestamp' => Element\Timestamp::class, |
59
|
|
|
'textaddon' => Element\TextAddon::class, |
60
|
|
|
'select' => Element\Select::class, |
61
|
|
|
'multiselect' => Element\MultiSelect::class, |
62
|
|
|
'hidden' => Element\Hidden::class, |
63
|
|
|
'checkbox' => Element\Checkbox::class, |
64
|
|
|
'ckeditor' => Element\CKEditor::class, |
65
|
|
|
'custom' => Element\Custom::class, |
66
|
|
|
'password' => Element\Password::class, |
67
|
|
|
'textarea' => Element\Textarea::class, |
68
|
|
|
'view' => Element\View::class, |
69
|
|
|
'image' => Element\Image::class, |
70
|
|
|
'images' => Element\Images::class, |
71
|
|
|
'file' => Element\File::class, |
72
|
|
|
'radio' => Element\Radio::class, |
73
|
|
|
'wysiwyg' => Element\Wysiwyg::class, |
74
|
|
|
'upload' => Element\Upload::class, |
75
|
|
|
'html' => Element\Html::class, |
76
|
|
|
'number' => Element\Number::class, |
77
|
|
|
'dependentselect' => Element\DependentSelect::class, |
78
|
|
|
]); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|