public 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; } return $this->encodeLabel ? Html::encode($label) : $label; }
protected function renderHeaderCellContent() { $parentHeader = parent::renderHeaderCellContent(); $sort = $this->grid->dataProvider->getSort(); $direction = $sort->getAttributeOrder($this->attribute); if ($direction === null) { return $parentHeader; } $class = $direction == SORT_ASC ? 'asc' : 'desc'; return $parentHeader . Html::tag('span', '', ['class' => [$class]]); }
/** * Used to render footer like header */ protected function renderFooterCellContent() { return parent::renderHeaderCellContent(); }
/** * @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) { $label =& $this->label; 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; } }