createUrl() публичный Метод

This method is called for each button and each row.
public createUrl ( string $action, ActiveRecord $model, mixed $key, integer $index ) : string
$action string the button name (or action ID)
$model yii\db\ActiveRecord the data model
$key mixed the key associated with the data model
$index integer the current row index
Результат string the created URL
Пример #1
0
 public function createUrl($action, $model, $key, $index)
 {
     if (method_exists($model, 'getUrl') && ($url = $model->getUrl($action)) && !$this->urlCreator) {
         return $url;
     } else {
         return parent::createUrl($action, $model, $key, $index);
     }
 }
Пример #2
0
 public function createUrl($action, $model, $key, $index)
 {
     switch ($action) {
         case 'view':
             $action = 'read-form';
             break;
         case 'update':
             $action = 'update-form';
             break;
         case 'delete':
             $action = 'delete-form';
             break;
     }
     return parent::createUrl($action, $model, $key, $index);
 }