Fix #19899: Fixed GridView in some cases calling Model::generateAttributeLabel() to generate label values that are never used

This commit is contained in:
PowerGamer1
2023-07-24 11:52:38 +03:00
committed by GitHub
parent 79c83ba7db
commit c8c0ea97c4
5 changed files with 95 additions and 8 deletions

View File

@ -183,15 +183,11 @@ class ActiveDataProvider extends BaseDataProvider
$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);
}
}
}
if ($sort->modelClass === null) {
$sort->modelClass = $modelClass;
}
}
}