yiiapi/framework/web/CWidgetFactory.php
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
/**
* CWidgetFactory class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008-2013 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
/**
* CWidgetFactory creates new widgets to be used in views.
*
* CWidgetFactory is used as the default "widgetFactory" application component.
*
* When calling {@link CBaseController::createWidget}, {@link CBaseController::widget}
* or {@link CBaseController::beginWidget}, if the "widgetFactory" component is installed,
* it will be used to create the requested widget. To install the "widgetFactory" component,
* we should have the following application configuration:
* <pre>
* return array(
* 'components'=>array(
* 'widgetFactory'=>array(
* 'class'=>'CWidgetFactory',
* ),
* ),
* )
* </pre>
*
* CWidgetFactory implements the "skin" feature, which allows a new widget to be created
* and initialized with a set of predefined property values (called skin).
*
* When CWidgetFactory is used to create a new widget, it will first instantiate the
* widget instance. It then checks if there is a skin available for this widget
* according to the widget class name and the widget {@link CWidget::skin} property.
* If a skin is found, it will be merged with the initial properties passed via
* {@link createWidget}. Then the merged initial properties will be used to initialize
* the newly created widget instance.
*
* As aforementioned, a skin is a set of initial property values for a widget.
* It is thus represented as an associative array of name-value pairs.
* Skins are stored in PHP scripts like other configurations. Each script file stores the skins
* for a particular widget type and is named as the widget class name (e.g. CLinkPager.php).
* Each widget type may have one or several skins, identified by the skin name set via
* {@link CWidget::skin} property. If the {@link CWidget::skin} property is not set for a given
* widget, it means the default skin would be used. The following shows the possible skins for
* the {@link CLinkPager} widget:
* <pre>
* return array(
* 'default'=>array(
* 'nextPageLabel'=>'>>',
* 'prevPageLabel'=>'<<',
* ),
* 'short'=>array(
* 'header'=>'',
* 'maxButtonCount'=>5,
* ),
* );
* </pre>
后面还有 137 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
