mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-08 00:47:55 +08:00
Fixes #1499: Added ActionColumn::controller property to support customizing the controller for handling GridView actions
This commit is contained in:
@ -22,6 +22,7 @@ Yii Framework 2 Change Log
|
|||||||
- Enh #1406: DB Schema support for Oracle Database (p0larbeer, qiangxue)
|
- Enh #1406: DB Schema support for Oracle Database (p0larbeer, qiangxue)
|
||||||
- Enh #1437: Added ListView::viewParams (qiangxue)
|
- Enh #1437: Added ListView::viewParams (qiangxue)
|
||||||
- Enh #1469: ActiveRecord::find() now works with default conditions (default scope) applied by createQuery (cebe)
|
- Enh #1469: ActiveRecord::find() now works with default conditions (default scope) applied by createQuery (cebe)
|
||||||
|
- Enh #1499: Added `ActionColumn::controller` property to support customizing the controller for handling GridView actions (qiangxue)
|
||||||
- Enh #1523: Query conditions now allow to use the NOT operator (cebe)
|
- Enh #1523: Query conditions now allow to use the NOT operator (cebe)
|
||||||
- Enh #1552: It is now possible to use multiple bootstrap NavBar in a single page (Alex-Code)
|
- Enh #1552: It is now possible to use multiple bootstrap NavBar in a single page (Alex-Code)
|
||||||
- Enh #1572: Added `yii\web\Controller::createAbsoluteUrl()` (samdark)
|
- Enh #1572: Added `yii\web\Controller::createAbsoluteUrl()` (samdark)
|
||||||
|
|||||||
@ -19,6 +19,13 @@ use yii\helpers\Html;
|
|||||||
*/
|
*/
|
||||||
class ActionColumn extends Column
|
class ActionColumn extends Column
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @var string the ID of the controller that should handle the actions specified here.
|
||||||
|
* If not set, it will use the currently active controller. This property is mainly used by
|
||||||
|
* [[urlCreator]] to create URLs for different actions. The value of this property will be prefixed
|
||||||
|
* to each action name to form the route of the action.
|
||||||
|
*/
|
||||||
|
public $controller;
|
||||||
public $template = '{view} {update} {delete}';
|
public $template = '{view} {update} {delete}';
|
||||||
public $buttons = [];
|
public $buttons = [];
|
||||||
public $urlCreator;
|
public $urlCreator;
|
||||||
@ -75,7 +82,8 @@ class ActionColumn extends Column
|
|||||||
return call_user_func($this->urlCreator, $model, $key, $index, $action);
|
return call_user_func($this->urlCreator, $model, $key, $index, $action);
|
||||||
} else {
|
} else {
|
||||||
$params = is_array($key) ? $key : ['id' => $key];
|
$params = is_array($key) ? $key : ['id' => $key];
|
||||||
return Yii::$app->controller->createUrl($action, $params);
|
$route = $this->controller ? $this->controller . '/' . $action : $action;
|
||||||
|
return Yii::$app->controller->createUrl($route, $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user