|
|
|
@ -19,10 +19,9 @@ use yii\helpers\Html;
|
|
|
|
|
* |
|
|
|
|
* ```php |
|
|
|
|
* echo TypeAhead::widget(array( |
|
|
|
|
* 'form' => $form, |
|
|
|
|
* 'model' => $model, |
|
|
|
|
* 'attribute' => 'country', |
|
|
|
|
* 'pluginOptions' => array( |
|
|
|
|
* 'clientOptions' => array( |
|
|
|
|
* 'source' => array('USA', 'ESP'), |
|
|
|
|
* ), |
|
|
|
|
* )); |
|
|
|
@ -33,7 +32,7 @@ use yii\helpers\Html;
|
|
|
|
|
* ```php |
|
|
|
|
* echo TypeAhead::widget(array( |
|
|
|
|
* 'name' => 'country', |
|
|
|
|
* 'pluginOptions' => array( |
|
|
|
|
* 'cloentOptions' => array( |
|
|
|
|
* 'source' => array('USA', 'ESP'), |
|
|
|
|
* ), |
|
|
|
|
* )); |
|
|
|
@ -77,8 +76,8 @@ class TypeAhead extends Widget
|
|
|
|
|
* If [[model]] is null or not from an [[Model]] instance, then the field will be rendered according to |
|
|
|
|
* the [[name]] attribute. |
|
|
|
|
* @return string the rendering result |
|
|
|
|
* @throws InvalidConfigException when none of the required attributes are set to render the textInput. That is, |
|
|
|
|
* if [[model]] and [[attribute]] are not set, then [[name]] is required. |
|
|
|
|
* @throws InvalidConfigException when none of the required attributes are set to render the textInput. |
|
|
|
|
* That is, if [[model]] and [[attribute]] are not set, then [[name]] is required. |
|
|
|
|
*/ |
|
|
|
|
public function renderField() |
|
|
|
|
{ |
|
|
|
@ -87,7 +86,7 @@ class TypeAhead extends Widget
|
|
|
|
|
} elseif ($this->name !== null) { |
|
|
|
|
return Html::textInput($this->name, $this->value, $this->options); |
|
|
|
|
} else { |
|
|
|
|
throw new InvalidConfigException('Either "name" or "model" and "attribute" properties must be specified.'); |
|
|
|
|
throw new InvalidConfigException("Either 'name' or 'model' and 'attribute' properties must be specified."); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|