public function imageField($model, $attribute, $htmlOptions = array())
 {
     $controlOptions = BsArray::popValue('controlOptions', $htmlOptions, array());
     $labelOptions = BsArray::popValue('labelOptions', $htmlOptions, array());
     $layout = $this->layout;
     $output = '';
     //$htmlOptions = BsHtml::addClassName('form-control',$htmlOptions);
     $output .= BsHtml::activeFileField($model, $attribute, $htmlOptions);
     //@TODO: render in field type partial?
     $attr = $model->{$attribute};
     if (!empty($attr)) {
         //Special logic for ContentTypes
         $tmpModel = $model;
         if ($model instanceof ContentType) {
             $tmpModel = $model->Content;
         }
         $output .= CHtml::image(Yii::app()->controller->createFrontendUrl('/site/getImage', array('id' => $tmpModel->id, 'modelName' => get_class($tmpModel), 'field' => $attribute, 'w' => 200)), 'Image', array('class' => 'img'));
         $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);
 }
 /**
  * Renders a file field for a model attribute.
  * @param CModel $model the data model.
  * @param string $attribute the attribute.
  * @param array $htmlOptions additional HTML attributes
  * @return string the generated input field.
  * @see BsHtml::activeFileField
  */
 public function fileField($model, $attribute, $htmlOptions = array())
 {
     return BsHtml::activeFileField($model, $attribute, $htmlOptions);
 }