1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Backpack\CRUD\app\View\Components; |
4
|
|
|
|
5
|
|
|
class FormModal extends Form |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Create a new component instance. |
9
|
|
|
* |
10
|
|
|
* @param string $controller The CRUD controller class name |
11
|
|
|
* @param string $operation The operation to use (create, update, etc.) |
12
|
|
|
* @param string|null $action Custom form action URL |
13
|
|
|
* @param string $method Form method (post, put, etc.) |
14
|
|
|
* @param string $buttonText Text to display on the button that opens the modal |
15
|
|
|
* @param string $modalTitle Title for the modal |
16
|
|
|
* @param string $buttonClass CSS classes for the button |
17
|
|
|
*/ |
18
|
|
|
public function __construct( |
19
|
|
|
public string $controller, |
20
|
|
|
public string $id = 'backpack-form', |
21
|
|
|
public string $operation = 'create', |
22
|
|
|
public string $formRouteOperation = 'create', |
23
|
|
|
public ?string $action = null, |
24
|
|
|
public string $method = 'post', |
25
|
|
|
public string $modalTitle = 'Form', |
26
|
|
|
public string $modalClasses = "modal-dialog modal-lg" |
27
|
|
|
) { |
28
|
|
|
parent::__construct($controller, $id, $operation, $action, $method); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Get the view / contents that represent the component. |
33
|
|
|
* |
34
|
|
|
* @return \Illuminate\Contracts\View\View|\Closure|string |
35
|
|
|
*/ |
36
|
|
|
public function render() |
37
|
|
|
{ |
38
|
|
|
return view('crud::components.form.modal_form', [ |
39
|
|
|
'crud' => $this->crud, |
40
|
|
|
'id' => $this->id, |
41
|
|
|
'operation' => $this->operation, |
42
|
|
|
'formRouteOperation' => $this->formRouteOperation, |
43
|
|
|
'action' => $this->action, |
44
|
|
|
'method' => $this->method, |
45
|
|
|
'modalTitle' => $this->modalTitle, |
46
|
|
|
'modalClasses' => $this->modalClasses, |
47
|
|
|
]); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|