Skip to content

Commit

Permalink
Add property $linkOptions into LinkSorter widget
Browse files Browse the repository at this point in the history
  • Loading branch information
zinzinday authored and cebe committed May 16, 2015
1 parent e313038 commit 968d59c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Yii Framework 2 Change Log
- Enh #8070: `yii\console\controllers\MessageController` now sorts created messages, even if there is no new one, while saving to PHP file (klimov-paul)
- Enh #8286: `yii\console\controllers\MessageController` improved allowing extraction of nested translator calls (klimov-paul)
- Enh #8415: `yii\helpers\Html` allows correct rendering of conditional comments containing `!IE` (salaros, klimov-paul)
- Enh #8444: Added `yii\widgets\LinkPager::$linkOptions` to allow configuring HTML attributes of the `a` tags (zinzinday)
- Chg #6354: `ErrorHandler::logException()` will now log the whole exception object instead of only its string representation (cebe)


Expand Down
8 changes: 7 additions & 1 deletion framework/widgets/LinkSorter.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ class LinkSorter extends Widget
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
public $options = ['class' => 'sorter'];
/**
* @var array HTML attributes for the link in a sorter container tag which are passed to [[Sort::link()]].
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
* @since 2.0.5
*/
public $linkOptions = [];


/**
Expand Down Expand Up @@ -68,7 +74,7 @@ protected function renderSortLinks()
$attributes = empty($this->attributes) ? array_keys($this->sort->attributes) : $this->attributes;
$links = [];
foreach ($attributes as $name) {
$links[] = $this->sort->link($name);
$links[] = $this->sort->link($name, $this->linkOptions);
}

return Html::ul($links, array_merge($this->options, ['encode' => false]));
Expand Down

0 comments on commit 968d59c

Please sign in to comment.