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