Esempio n. 1
0
 /**
  * Runs the widget.
  * This registers the necessary javascript code and renders the form close tag.
  * @throws InvalidCallException if `beginField()` and `endField()` calls are not matching
  */
 public function run()
 {
     if (!empty($this->_fields)) {
         throw new InvalidCallException('Each beginField() should have a matching endField() call.');
     }
     if ($this->enableClientScript) {
     }
     echo Html::endTag('div');
     echo Html::endForm();
 }
Esempio n. 2
0
 public static function error($model, $attribute, $options = [])
 {
     $attribute = static::getAttributeName($attribute);
     $error = $model->getFirstError($attribute);
     if ($error != null) {
         $tag = isset($options['tag']) ? $options['tag'] : 'div';
         $encode = !isset($options['encode']) || $options['encode'] !== false;
         unset($options['tag'], $options['encode']);
         return Html::tag($tag, $encode ? Html::encode($error) : $error, $options);
     } else {
         return "";
     }
 }
Esempio n. 3
0
 public function datePicker($options = [])
 {
     $options['class'] = implode('', $this->datePickerCssOptions);
     $options = array_merge($this->inputOptions, $options);
     $this->adjustLabelFor($options);
     $this->parts['{input}'] = Html::activeTextInput($this->model, $this->attribute, $options);
     if (isset($options['showDatePickerButton']) ? $options['showDatePickerButton'] : true) {
         $this->parts['{input}'] .= Html::a('Choose', 'javascript:;', ['class' => 'inputDateButton']);
     }
     return $this;
 }