framework/grid/DataColumn.php
protected function getHeaderCellLabel()
    {
        $provider = $this->grid->dataProvider;

        if ($this->label === null) {
            if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQueryInterface) {
                /* @var $modelClass Model */
                $modelClass = $provider->query->modelClass;
                $model = $modelClass::instance();
                $label = $model->getAttributeLabel($this->attribute);
            } elseif ($provider instanceof ArrayDataProvider && $provider->modelClass !== null) {
                /* @var $modelClass Model */
                $modelClass = $provider->modelClass;
                $model = $modelClass::instance();
                $label = $model->getAttributeLabel($this->attribute);
            } elseif ($this->grid->filterModel !== null && $this->grid->filterModel instanceof Model) {
                $label = $this->grid->filterModel->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 $label;
    }
protected function getHeaderCellLabel()
    {
        $provider = $this->grid->dataProvider;

        if ($this->label === null) {
            if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQueryInterface) {
                /* @var $modelClass Model */
                $modelClass = $provider->query->modelClass;
                $model = $modelClass::instance();
                $label = $model->getAttributeLabel($this->attribute);
            } elseif ($provider instanceof ArrayDataProvider && $provider->modelClass !== null) {
                /* @var $modelClass Model */
                $modelClass = $provider->modelClass;
                $model = $modelClass::instance();
                $label = $model->getAttributeLabel($this->attribute);
            } elseif ($this->grid->filterModel !== null && $this->grid->filterModel instanceof Model) {
                $label = $this->grid->filterModel->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 $label;
    }
protected function getHeaderCellLabel ( ) { $ provider = $ this -> grid -> dataProvider ; if ( $ this -> label === null ) { if ( $ provider instanceof ActiveDataProvider && $ provider -> query instanceof ActiveQueryInterface ) { /* @var $modelClass Model */ $ modelClass = $ provider -> query -> modelClass ; $ model = $ modelClass :: instance ( ) ; $ label = $ model -> getAttributeLabel ( $ this -> attribute ) ; } elseif ( $ provider instanceof ArrayDataProvider && $ provider -> modelClass !== null ) { /* @var $modelClass Model */ $ modelClass = $ provider -> modelClass ; $ model = $ modelClass :: instance ( ) ; $ label = $ model -> getAttributeLabel ( $ this -> attribute ) ; } elseif ( $ this -> grid -> filterModel !== null && $ this -> grid -> filterModel instanceof Model ) { $ label = $ this -> grid -> filterModel -> 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 $ label ; }
{@inheritdoc]
@since 2.0.8
{