diff --git a/ActiveField.php b/ActiveField.php index 44183b6..28c9ae8 100644 --- a/ActiveField.php +++ b/ActiveField.php @@ -290,6 +290,20 @@ class ActiveField extends \yii\widgets\ActiveField } /** + * Renders Bootstrap static form control. + * @param array $options the tag options in terms of name-value pairs. These will be rendered as + * the attributes of the resulting tag. There are also a special options: + * - encode: boolean, whether value should be HTML-encoded or not. + * @return $this the field object itself + */ + public function staticControl($options = []) + { + $this->adjustLabelFor($options); + $this->parts['{input}'] = Html::activeStaticControl($this->model, $this->attribute, $options); + return $this; + } + + /** * @inheritdoc */ public function label($label = null, $options = []) diff --git a/ActiveForm.php b/ActiveForm.php index 4a60ce0..a574fbf 100644 --- a/ActiveForm.php +++ b/ActiveForm.php @@ -97,4 +97,13 @@ class ActiveForm extends \yii\widgets\ActiveForm } parent::init(); } + + /** + * @inheritdoc + * @return ActiveField the created ActiveField object + */ + public function field($model, $attribute, $options = []) + { + return parent::field($model, $attribute, $options); + } } diff --git a/BaseHtml.php b/BaseHtml.php index 120896d..0d4eb21 100644 --- a/BaseHtml.php +++ b/BaseHtml.php @@ -8,7 +8,6 @@ namespace yii\bootstrap; use yii\helpers\ArrayHelper; -use yii\helpers\Html; /** * BaseHtml provides concrete implementation for [[Html]].