本文整理汇总了PHP中CFormElement::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP CFormElement::__construct方法的具体用法?PHP CFormElement::__construct怎么用?PHP CFormElement::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFormElement
的用法示例。
在下文中一共展示了CFormElement::__construct方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($config, $parent = null)
{
if ($parent == null) {
$parent = Yii::app()->controller;
}
parent::__construct($config, $parent);
}
示例2: __construct
/**
* Constructor
*
* @param string $name of the element.
* @param array $attributes to set to the element. Default is an empty array.
*
* @return void
*/
public function __construct($name, $attributes = [])
{
parent::__construct($name, $attributes);
$this['type'] = 'radio';
//$this['checked'] = isset($attributes['checked']) ? $attributes['checked'] : false;
//$this['value'] = isset($attributes['value']) ? $attributes['value'] : $name;
}
示例3: __construct
/**
* Constructor
*
* @param string $name of the element.
* @param array $attributes to set to the element. Default is an empty array.
*
* @return void
*/
public function __construct($name, $attributes = [])
{
parent::__construct($name, $attributes);
$this['type'] = 'checkbox';
$this['checked'] = isset($attributes['checked']) ? $attributes['checked'] : false;
$this['value'] = isset($attributes['value']) ? $attributes['value'] : $name;
$this->UseNameAsDefaultLabel(null);
}
示例4: __construct
/**
* Constructor
*
* @param string $name of the element.
* @param array $attributes to set to the element. Default is an empty array.
*
* @throws CFormException if missing <options>
*/
public function __construct($name, $attributes = [])
{
parent::__construct($name, $attributes);
$this['type'] = 'select';
$this->UseNameAsDefaultLabel();
if (!is_array($this['options'])) {
throw new CFormException("Select needs options, did you forget to specify them when creating the element?");
}
}
示例5: __construct
/**
* Constructor.
* If you override this method, make sure you do not modify the method
* signature, and also make sure you call the parent implementation.
* @param mixed $config the configuration for this form. It can be a configuration array
* or the path alias of a PHP script file that returns a configuration array.
* The configuration array consists of name-value pairs that are used to initialize
* the properties of this form.
* @param CModel $model the model object associated with this form. If it is null,
* the parent's model will be used instead.
* @param mixed $parent the direct parent of this form. This could be either a {@link CBaseController}
* object (a controller or a widget), or a {@link CForm} object.
* If the former, it means the form is a top-level form; if the latter, it means this form is a sub-form.
*/
public function __construct($config, $model = null, $parent = null)
{
$this->setModel($model);
if ($parent === null) {
$parent = Yii::app()->getController();
}
parent::__construct($config, $parent);
$this->init();
}
示例6: __construct
/**
* Constructor
*
* @param string $name of the element.
* @param array $attributes to set to the element. Default is an empty array.
*/
public function __construct($name, $attributes = [])
{
parent::__construct($name, $attributes);
$this['type'] = 'tel';
$this->UseNameAsDefaultLabel();
}
示例7: __construct
/**
* Constructor
*
* @param string name of the element.
* @param array attributes to set to the element. Default is an empty array.
*/
public function __construct($name, $attributes = array())
{
parent::__construct($name, $attributes);
$this['type'] = 'submit';
$this->UseNameAsDefaultValue();
}
示例8: __construct
/**
* Constructor
*
* @param string name of the element.
* @param array attributes to set to the element. Default is an empty array.
*/
public function __construct($name, $attributes = array())
{
parent::__construct($name, $attributes);
$this['space'] = 'space';
}
示例9: __construct
/**
* Constructor
*
* @param string $name of the element.
* @param array $attributes to set to the element. Default is an empty array.
*/
public function __construct($name, $attributes = [])
{
parent::__construct($name, $attributes);
$this['type'] = 'search-widget';
}
示例10: __construct
/**
* Constructor
*
* @param string $name of the element.
* @param array $attributes to set to the element. Default is an empty array.
*/
public function __construct($name, $attributes = [])
{
parent::__construct($name, $attributes);
$this['type'] = 'button';
$this->UseNameAsDefaultValue();
}