attributes() as $attribute) { $this->attributes[$attribute] = [ 'asc' => [$attribute => SORT_ASC], 'desc' => [$attribute => SORT_DESC], 'label' => $model->getAttributeLabel($attribute), 'default' => $default, ]; } if ($extraAttrbutes) { foreach ($extraAttrbutes as $k => $label) { $this->attributes[$k] = [ 'asc' => [$k => SORT_ASC], 'desc' => [$k => SORT_DESC], 'label' => $label, 'default' => $default, ]; } } } }