Skip to content

Commit 356cfe0

Browse files
committed
Adds support for calculated status
1 parent 3eff547 commit 356cfe0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

StatusColumn.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,15 @@ protected function initOptions()
9292
$this->_labelClasses[$option[0]] = $option[2];
9393
}
9494

95-
$this->value = function($model, $key, $index, $widget)
96-
{
97-
$attributeValue = $model->{$this->attribute};
95+
if ($this->value instanceof \Closure) {
96+
$userFunc = $this->value;
97+
} else {
98+
$userFunc = function ($model, $key, $index, $widget) {
99+
return $model->{$this->attribute};
100+
};
101+
}
102+
$this->value = function ($model, $key, $index, $widget) use ($userFunc) {
103+
$attributeValue = call_user_func($userFunc, $model, $key, $index, $widget);
98104

99105
if ( isset($widget->_labelClasses[$attributeValue], $widget->filter[$attributeValue]) )
100106
{

0 commit comments

Comments
 (0)