Skip to content

Commit ada244a

Browse files
author
Tortue Torche
committed
Add 'open' option for former_for() helper and fix its 'method' option.
1 parent 86a3915 commit ada244a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Efficiently/JqueryLaravel/helpers.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ function form_for_close()
110110
* 'controller' - open forms that point to controller actions. E.G. ['controller' => 'Controller@method']
111111
* 'method' - HTTP verb. Supported verbs are 'post', 'get', 'delete', 'patch', and 'put'. By default it will be 'post'.
112112
* 'data-remote' - If set to true, will allow the Unobtrusive JavaScript drivers to control the submit behavior. By default this behavior is an ajax submit.
113+
* 'open' - Form type. Supported values are 'horizontal_open', 'vertical_open', 'inline_open', 'search_open', 'secure_open', 'open_for_files', 'open'. By default it will be 'open'.
113114
* 'fallbackPrefix' - By default it will be 'create'.
114115
* @return \Former|string|null
115116
*/
@@ -153,11 +154,16 @@ function former_for($model, array $options = [])
153154
$action = array_pull($options, 'route');
154155
}
155156

156-
$result = Former::open()->method($method)->addClass($class)->setAttributes($options);
157+
$open = array_pull($options, 'open', 'open');
158+
159+
$former = app('former');
160+
161+
$result = $former->$open();
157162

158163
if ($actionType) {
159164
$result = call_user_func_array([$result, $actionType], (array) $action);
160165
}
166+
$result = $result->method($method)->addClass($class)->setAttributes($options);
161167

162168
return $result;
163169
}

0 commit comments

Comments
 (0)