Commit 8ee7f5d7 by Alexander Makarov

Merge branch 'origin/master'

parents 84f63295 50c6b690
......@@ -72,6 +72,7 @@ Yii Framework 2 Change Log
- Chg #3175: InvalidCallException, InvalidParamException, UnknownMethodException are now extended from SPL BadMethodCallException (samdark)
- Chg #3383: Added `$type` parameter to `IdentityInterface::findIdentityByAccessToken()` (qiangxue)
- Chg #3531: \yii\grid\GridView now allows any character (except ":") in the attribute part of the shorthand syntax for columns (rawtaz)
- Chg #3544: Added `$key` as a parameter to the callable specified via `yii\grid\DataColumn::value` (mdmunir)
- Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue)
- Chg: Added `$user` as the first parameter of `yii\rbac\Rule::execute()` (qiangxue)
- Chg: `yii\grid\DataColumn::getDataCellValue()` visibility is now `public` to allow accessing the value from a GridView directly (cebe)
......
......@@ -37,3 +37,8 @@ Upgrade from Yii 2.0 Beta
* If you are using `dropDownList()`, `listBox()`, `activeDropDownList()`, or `activeListBox()`
of `yii\helpers\Html`, and your list options use multiple blank spaces to format and align
option label texts, you need to specify the option `encodeSpaces` to be true.
* If you are using `yii\grid\GridView` and have configured a data column to use a PHP callable
to return cell values (via `yii\grid\DataColumn::value`), you may need to adjust the signature
of the callable to be `function ($model, $key, $index, $widget)`. The `$key` parameter was newly added
in this release.
......@@ -51,7 +51,7 @@ class DataColumn extends Column
public $label;
/**
* @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.
*
* 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
if (is_string($this->value)) {
return ArrayHelper::getValue($model, $this->value);
} else {
return call_user_func($this->value, $model, $index, $this);
return call_user_func($this->value, $model, $key, $index, $this);
}
} elseif ($this->attribute !== null) {
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