Skip to content

Commit 0111885

Browse files
committed
update changelog and readme
1 parent a7d1921 commit 0111885

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
2121
### Security
2222
- Nothing
2323

24+
## 2.2.0 - 2019-03-17
25+
26+
### Added
27+
- modal_view parameters to use own modal view
28+
- `serialize` parameter to define which current field values should be passed to the foreign CrudController
29+
2430
## 2.1.0 - 2019-02-10
2531

2632
### Added

README.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,21 +164,36 @@ With this package your are also able to add a create button for the foreign CRUD
164164

165165
### Modal view
166166

167+
#### By route
168+
167169
By default the modals are loaded automatically by using `entity` in `on_the_fly` of the field definition, e.g. resulting in `backpack_url($field['on_the_fly']['entity']).'/ajax/create'` for the create modal.
168170

169171
You can overwrite this behavior for all modals by setting an attribute:
170172

171173
```
172174
'on_the_fly' => [
173175
'entity' => 'entity',
174-
'create_modal' => 'route/to/modal/html',
175-
'edit_modal' => 'route/to/modal/html',
176-
'delete_modal' => 'route/to/modal/html',
176+
'create_modal' => 'route/to/modal/html',
177+
'edit_modal' => 'route/to/modal/html',
178+
'delete_modal' => 'route/to/modal/html',
177179
]
178180
```
179181

180182
> Please be aware that by using this attributes you will be completely responsible for the content of the modal! The defined request has to provide valid HTML which is then filled in `<div class="modal-content"></div>`
181183
184+
#### By view
185+
186+
Instead of defining a route you can also use a custom view by:
187+
188+
```
189+
'on_the_fly' => [
190+
'entity' => 'entity',
191+
'create_modal_view' => 'view.to.create.modal',
192+
'edit_modal_view' => 'view.to.edit.modal',
193+
'delete_modal_view' => 'view.to.delete.modal',
194+
]
195+
```
196+
182197
### Search logic
183198

184199
The "instant field" triggers the `ajaxIndex()` of the `EntityCrudController` where the field is defined and uses the fields `model` and `attribute` parameters to perform the search on the foreign model.
@@ -237,6 +252,18 @@ Instant Fields will try to auto-fill the select2 input after creating a new entr
237252
]
238253
```
239254

255+
### Passing current field values to foreign `EntityCrudController`
256+
257+
Sometimes you will need current values to be used for the creation of an foreign entity. You may define `serialize` with the IDs of the fields you need in the store request:
258+
259+
```
260+
'on_the_fly' => [
261+
'serialize' => ['type_id', 'name'],
262+
]
263+
```
264+
265+
So the current values of `type_id` and `name` will be available in the `$request` of the `ajaxStore` method of your foreign `EntityCrudController` (you will have to overwrite it).
266+
240267
### Fields
241268

242269
Publish the fields in your project and modify functionality

0 commit comments

Comments
 (0)