framework/data/ActiveDataProvider.php
public function setSort($value)
    {
        parent::setSort($value);
        if (($sort = $this->getSort()) !== false && $this->query instanceof ActiveQueryInterface) {
            /* @var $modelClass Model */
            $modelClass = $this->query->modelClass;
            $model = $modelClass::instance();
            if (empty($sort->attributes)) {
                foreach ($model->attributes() as $attribute) {
                    $sort->attributes[$attribute] = [
                        'asc' => [$attribute => SORT_ASC],
                        'desc' => [$attribute => SORT_DESC],
                        'label' => $model->getAttributeLabel($attribute),
                    ];
                }
            } else {
                foreach ($sort->attributes as $attribute => $config) {
                    if (!isset($config['label'])) {
                        $sort->attributes[$attribute]['label'] = $model->getAttributeLabel($attribute);
                    }
                }
            }
        }
    }
public function setSort($value)
    {
        parent::setSort($value);
        if (($sort = $this->getSort()) !== false && $this->query instanceof ActiveQueryInterface) {
            /* @var $modelClass Model */
            $modelClass = $this->query->modelClass;
            $model = $modelClass::instance();
            if (empty($sort->attributes)) {
                foreach ($model->attributes() as $attribute) {
                    $sort->attributes[$attribute] = [
                        'asc' => [$attribute => SORT_ASC],
                        'desc' => [$attribute => SORT_DESC],
                        'label' => $model->getAttributeLabel($attribute),
                    ];
                }
            } else {
                foreach ($sort->attributes as $attribute => $config) {
                    if (!isset($config['label'])) {
                        $sort->attributes[$attribute]['label'] = $model->getAttributeLabel($attribute);
                    }
                }
            }
        }
    }
public function setSort ( $ value ) { parent :: setSort ( $ value ) ; if ( ( $ sort = $ this -> getSort ( ) ) !== false && $ this -> query instanceof ActiveQueryInterface ) { /* @var $modelClass Model */ $ modelClass = $ this -> query -> modelClass ; $ model = $ modelClass :: instance ( ) ; if ( empty ( $ sort -> attributes ) ) { foreach ( $ model -> attributes ( ) as $ attribute ) { $ sort -> attributes [ $ attribute ] = [ 'asc' => [ $ attribute => SORT_ASC ] , 'desc' => [ $ attribute => SORT_DESC ] , 'label' => $ model -> getAttributeLabel ( $ attribute ) , ] ; } } else { foreach ( $ sort -> attributes as $ attribute => $ config ) { if ( ! isset ( $ config [ 'label' ] ) ) { $ sort -> attributes [ $ attribute ] [ 'label' ] = $ model -> getAttributeLabel ( $ attribute ) ; } } } } }
{@inheritdoc}
{