mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-17 06:48:59 +08:00
Fixes #9818: added reference to DI container practical usage to widgets guide
This commit is contained in:
@@ -69,6 +69,18 @@ Note that unlike [[yii\base\Widget::widget()]] which returns the rendering resul
|
|||||||
[[yii\base\Widget::begin()]] returns an instance of the widget which you can use to build the widget content.
|
[[yii\base\Widget::begin()]] returns an instance of the widget which you can use to build the widget content.
|
||||||
|
|
||||||
|
|
||||||
|
### Configuring global defaults
|
||||||
|
|
||||||
|
Global defaults for a widget type could be configured via DI container:
|
||||||
|
|
||||||
|
```php
|
||||||
|
\Yii::$container->set('yii\widgets\LinkPager', ['maxButtonCount' => 5]);
|
||||||
|
```
|
||||||
|
|
||||||
|
See ["Practical Usage" section in Dependency Injection Container guide](concept-di-container.md#practical-usage) for
|
||||||
|
details.
|
||||||
|
|
||||||
|
|
||||||
## Creating Widgets <span id="creating-widgets"></span>
|
## Creating Widgets <span id="creating-widgets"></span>
|
||||||
|
|
||||||
To create a widget, extend from [[yii\base\Widget]] and override the [[yii\base\Widget::init()]] and/or
|
To create a widget, extend from [[yii\base\Widget]] and override the [[yii\base\Widget::init()]] and/or
|
||||||
|
|||||||
Reference in New Issue
Block a user