Example #1
0
 /**
  * Renders the widget.
  */
 public function run()
 {
     if ($this->hasModel() && $this->activeField) {
         $this->options = $this->activeField->calculateClientInputOption($this->options);
         $input = ActiveHtml::activeTextInput($this->model, $this->attribute, $this->options);
     } else {
         $input = Html::textInput($this->name, $this->value, $this->options);
     }
     if ($this->output === self::BASE64) {
         $src = $this->captcha->getDataUri();
     } else {
         $src = Url::modify([$this->captchaAction, 'v' => uniqid()], Url::ABS);
     }
     $image = Html::img($src, $this->imageOptions);
     echo strtr($this->template, ['{input}' => $input, '{image}' => $image]);
 }