Browse Source

changed parameter ordering.

tags/2.0.0-alpha
Qiang Xue 11 years ago
parent
commit
c3df0beecd
  1. 6
      framework/yii/helpers/base/Html.php
  2. 4
      tests/unit/framework/helpers/HtmlTest.php

6
framework/yii/helpers/base/Html.php

@ -855,7 +855,7 @@ class Html
* The signature of this callback must be:
*
* ~~~
* function ($index, $item)
* function ($item, $index)
* ~~~
*
* where $index is the array key corresponding to `$item` in `$items`. The callback should return
@ -876,7 +876,7 @@ class Html
$results = array();
foreach ($items as $index => $item) {
if ($formatter !== null) {
$results[] = call_user_func($formatter, $index, $item);
$results[] = call_user_func($formatter, $item, $index);
} else {
$results[] = static::tag('li', $encode ? static::encode($item) : $item, $itemOptions);
}
@ -897,7 +897,7 @@ class Html
* The signature of this callback must be:
*
* ~~~
* function ($index, $item)
* function ($item, $index)
* ~~~
*
* where $index is the array key corresponding to `$item` in `$items`. The callback should return

4
tests/unit/framework/helpers/HtmlTest.php

@ -388,7 +388,7 @@ EOD;
EOD;
$this->assertEqualsWithoutLE($expected, Html::ul($data, array(
'class' => 'test',
'item' => function($index, $item) {
'item' => function($item, $index) {
return "<li class=\"item-$index\">$item</li>";
}
)));
@ -418,7 +418,7 @@ EOD;
EOD;
$this->assertEqualsWithoutLE($expected, Html::ol($data, array(
'class' => 'test',
'item' => function($index, $item) {
'item' => function($item, $index) {
return "<li class=\"item-$index\">$item</li>";
}
)));

Loading…
Cancel
Save