Skip to content

Commit

Permalink
Added LinkSorter::attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
qiangxue committed Sep 8, 2013
1 parent 02e3b45 commit 4edd842
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion framework/yii/widgets/LinkSorter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class LinkSorter extends Widget
* @var Sort the sort definition
*/
public $sort;
/**
* @var array list of the attributes that support sorting. If not set, it will be determined
* using [[Sort::attributes]].
*/
public $attributes;
/**
* @var array HTML attributes for the sorter container tag.
*/
Expand Down Expand Up @@ -58,8 +63,9 @@ public function run()
*/
protected function renderSortLinks()
{
$attributes = empty($this->atttributes) ? array_keys($this->sort->attributes) : $this->attributes;
$links = array();
foreach (array_keys($this->sort->attributes) as $name) {
foreach ($attributes as $name) {
$links[] = $this->sort->link($name);
}
return Html::ul($links, array('encode' => false));
Expand Down

0 comments on commit 4edd842

Please sign in to comment.