Browse Source

Widget IDs are now always unique no matter if it's the same request or new one

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
66e5be7f7f
  1. 1
      framework/CHANGELOG.md
  2. 7
      framework/yii/base/Widget.php

1
framework/CHANGELOG.md

@ -12,6 +12,7 @@ Yii Framework 2 Change Log
- Enh #1437: Added ListView::viewParams (qiangxue)
- Enh #1469: ActiveRecord::find() now works with default conditions (default scope) applied by createQuery (cebe)
- Enh: Added `favicon.ico` and `robots.txt` to defauly application templates (samdark)
- Enh: Widget IDs are now always unique no matter if it's the same request or new one (samdark)
- New #1438: [MongoDB integration](https://github.com/yiisoft/yii2-mongodb) ActiveRecord and Query (klimov-paul)
2.0.0 alpha, December 1, 2013

7
framework/yii/base/Widget.php

@ -25,11 +25,6 @@ use ReflectionClass;
class Widget extends Component implements ViewContextInterface
{
/**
* @var integer a counter used to generate [[id]] for widgets.
* @internal
*/
public static $counter = 0;
/**
* @var Widget[] the widgets that are currently being rendered (not ended). This property
* is maintained by [[begin()]] and [[end()]] methods.
* @internal
@ -101,7 +96,7 @@ class Widget extends Component implements ViewContextInterface
public function getId($autoGenerate = true)
{
if ($autoGenerate && $this->_id === null) {
$this->_id = 'w' . self::$counter++;
$this->_id = 'w-' . str_replace('.', '-', uniqid('', true));
}
return $this->_id;
}

Loading…
Cancel
Save