protected function getDefaultGridButtons($dataProvider)
    {
        if (is_callable($this->gridButtons)) {
            return call_user_func($this->gridButtons, $this, $dataProvider);
        }

        if (is_array($this->gridButtons)) {
            return $this->gridButtons;
        }

        if ($this->gridButtons !== null) {
            throw new InvalidConfigException('gridButtons property should be either null, array or callable.');
        }

        /** @var \yii\filters\ContentNegotiator $negotiator */
        $negotiator = $this->controller->getBehavior('contentNegotiator');

        return [
            [
                'icon'    => 'glyphicon glyphicon-file',
                'label'   => 'XLS',
                'url'     => Url::current([
                    $negotiator->formatParam                 => Response::FORMAT_XLS,
                    $dataProvider->pagination->pageSizeParam => -1,
                ]),
                'options' => ['class' => 'btn btn-default', 'data-pjax' => 0],
            ],
            [
                'icon'    => 'glyphicon glyphicon-file',
                'label'   => 'CSV',
                'url'     => Url::current([
                    $negotiator->formatParam                 => Response::FORMAT_CSV,
                    $dataProvider->pagination->pageSizeParam => -1,
                ]),
                'options' => ['class' => 'btn btn-default', 'data-pjax' => 0],
            ],
        ];
    }
protected function getDefaultGridButtons($dataProvider)
    {
        if (is_callable($this->gridButtons)) {
            return call_user_func($this->gridButtons, $this, $dataProvider);
        }

        if (is_array($this->gridButtons)) {
            return $this->gridButtons;
        }

        if ($this->gridButtons !== null) {
            throw new InvalidConfigException('gridButtons property should be either null, array or callable.');
        }

        /** @var \yii\filters\ContentNegotiator $negotiator */
        $negotiator = $this->controller->getBehavior('contentNegotiator');

        return [
            [
                'icon'    => 'glyphicon glyphicon-file',
                'label'   => 'XLS',
                'url'     => Url::current([
                    $negotiator->formatParam                 => Response::FORMAT_XLS,
                    $dataProvider->pagination->pageSizeParam => -1,
                ]),
                'options' => ['class' => 'btn btn-default', 'data-pjax' => 0],
            ],
            [
                'icon'    => 'glyphicon glyphicon-file',
                'label'   => 'CSV',
                'url'     => Url::current([
                    $negotiator->formatParam                 => Response::FORMAT_CSV,
                    $dataProvider->pagination->pageSizeParam => -1,
                ]),
                'options' => ['class' => 'btn btn-default', 'data-pjax' => 0],
            ],
        ];
    }
protected function getDefaultGridButtons ( $ dataProvider ) { if ( is_callable ( $ this -> gridButtons ) ) { return call_user_func ( $ this -> gridButtons , $ this , $ dataProvider ) ; } if ( is_array ( $ this -> gridButtons ) ) { return $ this -> gridButtons ; } if ( $ this -> gridButtons !== null ) { throw new InvalidConfigException ( 'gridButtons property should be either null, array or callable.' ) ; } /** @var \yii\filters\ContentNegotiator $negotiator */ $ negotiator = $ this -> controller -> getBehavior ( 'contentNegotiator' ) ; return [ [ 'icon' => 'glyphicon glyphicon-file' , 'label' => 'XLS' , 'url' => Url :: current ( [ $ negotiator -> formatParam => Response :: FORMAT_XLS , $ dataProvider -> pagination -> pageSizeParam => - 1 , ] ) , 'options' => [ 'class' => 'btn btn-default' , 'data-pjax' => 0 ] , ] , [ 'icon' => 'glyphicon glyphicon-file' , 'label' => 'CSV' , 'url' => Url :: current ( [ $ negotiator -> formatParam => Response :: FORMAT_CSV , $ dataProvider -> pagination -> pageSizeParam => - 1 , ] ) , 'options' => [ 'class' => 'btn btn-default' , 'data-pjax' => 0 ] , ] , ] ; }
Creates default buttons to perform actions on grid items.
@param \yii\data\BaseDataProvider $dataProvider
@return array each button is an array of keys: icon, label, url, options
Creates default buttons to perform actions on grid items .