kartik-v / yii2-detail-view

Various enhancements to the Yii 2 Detail View with ability to edit data and manage styles using BS3.
http://demos.krajee.com/detail-view
Other
70 stars 56 forks source link

value Closure first param should be $model, but it's null #153

Closed tsdogs closed 5 years ago

tsdogs commented 6 years ago

if I configure an attribute like

[
    'attribute'=>'name',
    'value'=>function ($model,$widget) {
        return $model['value'];
    }
],

this does not work as $model is NULL (I think because it's passing the $this->_form as parameter?)

in the yii2 DetailView the first attribute is the model and works as expected.

To solve this we need to use the$widget->model['value'] insthead.

IMHO the default behaviour should be respected, or documentation should report that the behaviour is not compatible with yii2 DetailView anymore.

BenasPaulikas commented 6 years ago

Same for me after doing composer update today

'value' => function($model) was working.

@kartik-v any ideas ?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

tsdogs commented 5 years ago

Ihmo this should be fixed.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.