yiiapi/framework/web/widgets/CInputWidget.php

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
/**
 * CInputWidget 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/
 */

/**
 * CInputWidget is the base class for widgets that collect user inputs.
 *
 * CInputWidget declares properties common among input widgets. An input widget
 * can be associated with a data model and an attribute, or a name and a value.
 * If the former, the name and the value will be generated automatically.
 * Child classes may use {@link resolveNameID} and {@link hasModel}.
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @package system.web.widgets
 * @since 1.0
 */
abstract class CInputWidget extends CWidget
{
	/**
	 * @var CModel the data model associated with this widget.
	 */
	public $model;
	/**
	 * @var string the attribute associated with this widget.
	 * The name can contain square brackets (e.g. 'name[1]') which is used to collect tabular data input.
	 */
	public $attribute;
	/**
	 * @var string the input name. This must be set if {@link model} is not set.
	 */
	public $name;
	/**
	 * @var string the input value
	 */
	public $value;
	/**
	 * @var array additional HTML options to be rendered in the input tag
	 */
	public $htmlOptions=array();


	/**
	 * @return array the name and the ID of the input.
	 * @throws CException in case input name and ID cannot be resolved.
	 */
	protected function resolveNameID()
	{
		if($this->name!==null)
			$name=$this->name;
		elseif(isset($this->htmlOptions['name']))
			$name=$this->htmlOptions['name'];
		elseif($this->hasModel())
			$name=CHtml::activeName($this->model,$this->attribute);
		else
后面还有 21 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。