/**
  * @inheritdoc
  */
 protected function renderHeaderCellContent()
 {
     if ($this->header !== null || $this->label === null && $this->attribute === null) {
         return parent::renderHeaderCellContent();
     }
     $provider = $this->grid->dataProvider;
     if ($this->label === null) {
         if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQueryInterface) {
             /* @var $model Model */
             $model = new $provider->query->modelClass();
             $label = $model->getAttributeLabel($this->attribute);
         } else {
             $models = $provider->getModels();
             if (($model = reset($models)) instanceof Model) {
                 /* @var $model Model */
                 $label = $model->getAttributeLabel($this->attribute);
             } else {
                 $label = Inflector::camel2words($this->attribute);
             }
         }
     } else {
         $label = $this->label;
     }
     if ($this->attribute !== null && $this->enableSorting && ($sort = $provider->getSort()) !== false && $sort->hasAttribute($this->attribute)) {
         return $sort->link($this->attribute, array_merge($this->sortLinkOptions, ['label' => $this->encodeLabel ? Html::encode($label) : $label]));
     } else {
         return $this->encodeLabel ? Html::encode($label) : $label;
     }
 }
 /**
  * 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
  */
 protected function renderHeaderCellContent()
 {
     $name = $this->name;
     if (substr_compare($name, '[]', -2, 2) === 0) {
         $name = substr($name, 0, -2);
     }
     if (substr_compare($name, ']', -1, 1) === 0) {
         $name = substr($name, 0, -1) . '_all]';
     } else {
         $name .= '_all';
     }
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return Html::checkBox($name, false, ['class' => 'select-on-check-all']);
     }
 }