Browse Source

Fixes #980: Changed the default way of generating action URLs for ActionColumn.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
2b2c22eee4
  1. 3
      framework/yii/grid/ActionColumn.php

3
framework/yii/grid/ActionColumn.php

@ -72,12 +72,11 @@ class ActionColumn extends Column
if ($this->urlCreator instanceof Closure) { if ($this->urlCreator instanceof Closure) {
return call_user_func($this->urlCreator, $model, $action); return call_user_func($this->urlCreator, $model, $action);
} else { } else {
$route = Inflector::camel2id(StringHelper::basename(get_class($model))) . '/' . $action;
$params = $model->getPrimaryKey(true); $params = $model->getPrimaryKey(true);
if (count($params) === 1) { if (count($params) === 1) {
$params = array('id' => reset($params)); $params = array('id' => reset($params));
} }
return Yii::$app->getUrlManager()->createUrl($route, $params); return Yii::$app->controller->createUrl($action, $params);
} }
} }

Loading…
Cancel
Save