File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,12 @@ or anonymous function which return array of items and has the following signatur
101
101
function($data) {}
102
102
```
103
103
104
- ** options** * array* : the HTML attributes for the input
104
+ ** options** * array* |* Closure* : the HTML attributes for the input, you can set it as array
105
+ or an anonymous function with the following signature:
106
+
107
+ ``` php
108
+ function($data) {}
109
+ ```
105
110
106
111
** headerOptions** * array* : the HTML attributes for the header cell
107
112
Original file line number Diff line number Diff line change @@ -228,7 +228,13 @@ private function normalize($name) {
228
228
*/
229
229
public function renderInput ($ name , $ options )
230
230
{
231
- $ options = Arrayhelper::merge ($ this ->options , $ options );
231
+ if ($ this ->options instanceof \Closure) {
232
+ $ optionsExt = call_user_func ($ this ->options , $ this ->getModel ());
233
+ } else {
234
+ $ optionsExt = $ this ->options ;
235
+ }
236
+
237
+ $ options = Arrayhelper::merge ($ optionsExt , $ options );
232
238
$ method = 'render ' . Inflector::camelize ($ this ->type );
233
239
$ value = $ this ->prepareValue ();
234
240
You can’t perform that action at this time.
0 commit comments