Commit 33727859 by Qiang Xue

Merge pull request #3544 from MDMunir/patch-1

Add $key to function parameter
parents 11826547 ff4307be
...@@ -77,6 +77,7 @@ Yii Framework 2 Change Log ...@@ -77,6 +77,7 @@ Yii Framework 2 Change Log
- Chg: `yii\data\ActiveDataProvider::$query` will not be modified directly with pagination and sorting anymore so it will be reuseable (cebe) - Chg: `yii\data\ActiveDataProvider::$query` will not be modified directly with pagination and sorting anymore so it will be reuseable (cebe)
- Chg: Removed `yii\rest\ActiveController::$transactional` property and connected functionality (samdark) - Chg: Removed `yii\rest\ActiveController::$transactional` property and connected functionality (samdark)
- Chg: Changed the default value of the `keyPrefix` property of cache components to be null (qiangxue) - Chg: Changed the default value of the `keyPrefix` property of cache components to be null (qiangxue)
- Chg #3544: Added `$key` as parameter of `yii\grid\DataColumn::value` (mdmunir)
2.0.0-beta April 13, 2014 2.0.0-beta April 13, 2014
------------------------- -------------------------
......
...@@ -51,7 +51,7 @@ class DataColumn extends Column ...@@ -51,7 +51,7 @@ class DataColumn extends Column
public $label; public $label;
/** /**
* @var string|\Closure an anonymous function that returns the value to be displayed for every data model. * @var string|\Closure an anonymous function that returns the value to be displayed for every data model.
* The signature of this function is `function ($model, $index, $widget)`. * The signature of this function is `function ($model, $key, $index, $widget)`.
* If this is not set, `$model[$attribute]` will be used to obtain the value. * If this is not set, `$model[$attribute]` will be used to obtain the value.
* *
* You may also set this property to a string representing the attribute name to be displayed in this column. * You may also set this property to a string representing the attribute name to be displayed in this column.
...@@ -176,7 +176,7 @@ class DataColumn extends Column ...@@ -176,7 +176,7 @@ class DataColumn extends Column
if (is_string($this->value)) { if (is_string($this->value)) {
return ArrayHelper::getValue($model, $this->value); return ArrayHelper::getValue($model, $this->value);
} else { } else {
return call_user_func($this->value, $model, $index, $this); return call_user_func($this->value, $model, $key, $index, $this);
} }
} elseif ($this->attribute !== null) { } elseif ($this->attribute !== null) {
return ArrayHelper::getValue($model, $this->attribute); return ArrayHelper::getValue($model, $this->attribute);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment