本文整理汇总了PHP中BsHtml::setLabelOptionsByLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP BsHtml::setLabelOptionsByLayout方法的具体用法?PHP BsHtml::setLabelOptionsByLayout怎么用?PHP BsHtml::setLabelOptionsByLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BsHtml
的用法示例。
在下文中一共展示了BsHtml::setLabelOptionsByLayout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fileField
public function fileField($model, $attribute, $htmlOptions = array())
{
$controlOptions = BsArray::popValue('controlOptions', $htmlOptions, array());
$labelOptions = BsArray::popValue('labelOptions', $htmlOptions, array());
$layout = $this->layout;
$output = '';
$output .= CHtml::activeFileField($model, $attribute, $htmlOptions);
$attr = $model->{$attribute};
if (!empty($attr)) {
//Special logic for ContentTypes
$tmpModel = $model;
if ($model instanceof ContentType) {
$tmpModel = $model->Content;
}
$output .= '<p class="file">' . CHtml::link($model->{$attribute}, array('/site/getFile', 'id' => $tmpModel->id, 'field' => $attribute, 'modelName' => get_class($tmpModel))) . '</p>';
$output .= '<div class="checkbox">' . CHtml::checkBox($attribute . '_delete');
$output .= CHtml::label('Delete?', $attribute . '_delete') . '</div>';
}
$htmlOptions['input'] = $output;
$htmlOptions['labelOptions'] = BsHtml::setLabelOptionsByLayout($layout, $labelOptions);
if (!empty($layout)) {
if ($layout === BsHtml::FORM_LAYOUT_HORIZONTAL) {
$controlClass = BsArray::popValue('class', $controlOptions, BsHtml::$formLayoutHorizontalControlClass);
BsHtml::addCssClass($controlClass, $htmlOptions['controlOptions']);
}
}
return BsHTML::activeTextFieldControlGroup($model, $attribute, $htmlOptions);
}
示例2: processRowOptions
/**
* Processes the options for a input row.
* @param CModel $model the data model.
* @param string $attribute the attribute name.
* @param array $htmlOptions the options.
* @return array the processed options.
*/
protected function processRowOptions($model, $attribute, $options)
{
$errorOptions = BsArray::popValue('errorOptions', $options, array());
$errorOptions['type'] = $this->helpType;
$error = $this->error($model, $attribute, $errorOptions);
// kind of a hack for ajax forms but this works for now.
if (!empty($error) && strpos($error, 'display:none') === false) {
$options['color'] = BsHtml::INPUT_COLOR_ERROR;
}
if (!$this->hideInlineErrors) {
$options['error'] = $error;
}
$helpOptions = BsArray::popValue('helpOptions', $options, array());
$helpOptions['type'] = $this->helpType;
$labelOptions = BsArray::popValue('labelOptions', $options, array());
$options['helpOptions'] = $helpOptions;
$options['labelOptions'] = BsHtml::setLabelOptionsByLayout($this->layout, $labelOptions);
$options['formLayout'] = $this->layout;
return $options;
}