src/widget/CheckboxColumn.php
protected function renderHeaderCellContent()
    {
        $name = rtrim($this->name, '[]') . '_all';
        $id = $this->grid->options['id'];
        $options = json_encode([
            'name' => $this->name,
            'multiple' => $this->multiple,
            'checkAll' => $name,
        ]);
        $this->grid->getView()->registerJs("jQuery('#$id').yiiGridView('setSelectionColumn', $options);");
        if ($this->header !== null || !$this->multiple) {
            return parent::renderHeaderCellContent();
        } else {
            $content = Html::tag('button',Html::checkBox($name, false, ['class' => 'select-on-check-all','data-target'=>$this->name,'data-checkall'=>1,'data-parent-id'=>$id]).' <span class="caret"></span>',[            
                    'type'  => 'button',
                    'class' => 'btn btn-default dropdown-toggle',
                    'data-toggle' => 'dropdown',
                ]);
            
            $buttons = preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) use ($model, $key, $index) {
                    $name = $matches[1];
                    $module = \Yii::$app->user->can(\Yii::$app->controller->module->id.'/'.\Yii::$app->controller->id.'/'.$name);
                    if($module){
                        if (isset($this->buttons[$name])) {
                            $url = $this->createUrl($name, $model, $key, $index);
                            if(call_user_func($this->checkaccess, $url)){
                                return call_user_func($this->buttons[$name], $url, $model);
                            }
                            else{
                                return '';
                            }
                       } 
                    else {
                            return '';
                        }
                    }
                }, $this->template);

                if($buttons==''){
                    return $buttons;
                }
                $content .= Html::tag('ul',$buttons,[             
                            'class' => 'dropdown-menu pull-right',
                            'role' => 'menu',
                        ]);

                return Html::tag('div',$content, [
                            'class' => 'dropdown'
                        ]);
        }
    }
protected function renderHeaderCellContent()
    {
        $name = rtrim($this->name, '[]') . '_all';
        $id = $this->grid->options['id'];
        $options = json_encode([
            'name' => $this->name,
            'multiple' => $this->multiple,
            'checkAll' => $name,
        ]);
        $this->grid->getView()->registerJs("jQuery('#$id').yiiGridView('setSelectionColumn', $options);");
        if ($this->header !== null || !$this->multiple) {
            return parent::renderHeaderCellContent();
        } else {
            $content = Html::tag('button',Html::checkBox($name, false, ['class' => 'select-on-check-all','data-target'=>$this->name,'data-checkall'=>1,'data-parent-id'=>$id]).' <span class="caret"></span>',[            
                    'type'  => 'button',
                    'class' => 'btn btn-default dropdown-toggle',
                    'data-toggle' => 'dropdown',
                ]);
            
            $buttons = preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) use ($model, $key, $index) {
                    $name = $matches[1];
                    $module = \Yii::$app->user->can(\Yii::$app->controller->module->id.'/'.\Yii::$app->controller->id.'/'.$name);
                    if($module){
                        if (isset($this->buttons[$name])) {
                            $url = $this->createUrl($name, $model, $key, $index);
                            if(call_user_func($this->checkaccess, $url)){
                                return call_user_func($this->buttons[$name], $url, $model);
                            }
                            else{
                                return '';
                            }
                       } 
                    else {
                            return '';
                        }
                    }
                }, $this->template);

                if($buttons==''){
                    return $buttons;
                }
                $content .= Html::tag('ul',$buttons,[             
                            'class' => 'dropdown-menu pull-right',
                            'role' => 'menu',
                        ]);

                return Html::tag('div',$content, [
                            'class' => 'dropdown'
                        ]);
        }
    }
Renders the header cell content.
The default implementation simply renders [[header]].
This method may be overridden to customize the rendering of the header cell.
@return string the rendering result