Browse Source

Method `ActiveField::staticControl()` added

tags/2.0.6
Klimov Paul 10 years ago
parent
commit
236d866be4
  1. 14
      ActiveField.php
  2. 9
      ActiveForm.php
  3. 1
      BaseHtml.php

14
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 * @inheritdoc
*/ */
public function label($label = null, $options = []) public function label($label = null, $options = [])

9
ActiveForm.php

@ -97,4 +97,13 @@ class ActiveForm extends \yii\widgets\ActiveForm
} }
parent::init(); parent::init();
} }
/**
* @inheritdoc
* @return ActiveField the created ActiveField object
*/
public function field($model, $attribute, $options = [])
{
return parent::field($model, $attribute, $options);
}
} }

1
BaseHtml.php

@ -8,7 +8,6 @@
namespace yii\bootstrap; namespace yii\bootstrap;
use yii\helpers\ArrayHelper; use yii\helpers\ArrayHelper;
use yii\helpers\Html;
/** /**
* BaseHtml provides concrete implementation for [[Html]]. * BaseHtml provides concrete implementation for [[Html]].

Loading…
Cancel
Save