本文整理汇总了PHP中CModel::getAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP CModel::getAttributes方法的具体用法?PHP CModel::getAttributes怎么用?PHP CModel::getAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CModel
的用法示例。
在下文中一共展示了CModel::getAttributes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderInput
public function renderInput(CModel $model, $attribute, array $htmlOptions = array())
{
$action = new Actions();
$action->setAttributes($model->getAttributes(), false);
$defaultOptions = array('id' => $this->resolveId($attribute));
$htmlOptions = X2Html::mergeHtmlOptions($defaultOptions, $htmlOptions);
return preg_replace('/Actions(\\[[^\\]]*\\])/', get_class($this->formModel) . '$1', $action->renderInput($attribute, $htmlOptions));
}
示例2: getAttributes
public function getAttributes($names = null)
{
if ($names == null) {
return $this->_attributes;
} else {
parent::getAttributes($names);
}
}
示例3: getAttributes
/**
* Returns all attribute values.
* @param array $names list of attributes whose value needs to be returned.
* Defaults to null, meaning all attributes as listed in {@link attributeNames} will be returned.
* If it is an array, only the attributes in the array will be returned.
* @param bool $includeId
* @return array attribute values (name=>value).
*/
public function getAttributes($names = null, $includeId = true)
{
$prepared = [];
if ($includeId) {
$prepared['id'] = $this->id;
}
$attributes = parent::getAttributes($names);
return array_merge($prepared, $attributes);
}