Commit 4edd8425 authored by Qiang Xue's avatar Qiang Xue

Added LinkSorter::attributes.

parent 02e3b451
...@@ -27,6 +27,11 @@ class LinkSorter extends Widget ...@@ -27,6 +27,11 @@ class LinkSorter extends Widget
* @var Sort the sort definition * @var Sort the sort definition
*/ */
public $sort; 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. * @var array HTML attributes for the sorter container tag.
*/ */
...@@ -58,8 +63,9 @@ class LinkSorter extends Widget ...@@ -58,8 +63,9 @@ class LinkSorter extends Widget
*/ */
protected function renderSortLinks() protected function renderSortLinks()
{ {
$attributes = empty($this->atttributes) ? array_keys($this->sort->attributes) : $this->attributes;
$links = array(); $links = array();
foreach (array_keys($this->sort->attributes) as $name) { foreach ($attributes as $name) {
$links[] = $this->sort->link($name); $links[] = $this->sort->link($name);
} }
return Html::ul($links, array('encode' => false)); return Html::ul($links, array('encode' => false));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment