Skip to content

Commit

Permalink
Again support for URL
Browse files Browse the repository at this point in the history
  • Loading branch information
omnilight committed Apr 13, 2016
1 parent ca289a4 commit 3228acb
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion grid/columns/ActionColumn.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Closure;
use Yii;
use yii\helpers\Html;
use yii\helpers\Url;
use yz\admin\helpers\Rbac;
use yz\admin\helpers\RouteNormalizer;
use yz\icons\Icons;
Expand All @@ -18,7 +19,6 @@ class ActionColumn extends \yii\grid\ActionColumn
/**
* Indicates whether to add return URL to the default buttons
* @var bool
* @deprecated
*/
public $addReturnUrl = true;
/**
Expand Down Expand Up @@ -107,4 +107,22 @@ protected function checkAccessInternal($action, $model, $key, $index)
return $this->checkAccess($action, $model, $key, $index);
}
}

/**
* @inheritdoc
*/
public function createUrl($action, $model, $key, $index)
{
if (is_callable($this->urlCreator)) {
return call_user_func($this->urlCreator, $action, $model, $key, $index);
} else {
$params = is_array($key) ? $key : ['id' => (string) $key];
if ($this->addReturnUrl) {
$params['return'] = Url::current();
}
$params[0] = $this->controller ? $this->controller . '/' . $action : $action;

return Url::toRoute($params);
}
}
}

0 comments on commit 3228acb

Please sign in to comment.