예제 #1
0
    public function init(){

        //Changing Input Options Merge with form-class
        $this->inputOptions = ['placeHolder' => $this->model->getAttributeLabel($this->attribute), 'class' => 'form-control'];

        parent::init();
    }
예제 #2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     if (!isset($this->labelOptions['class']) && !empty($this->model->{$this->attribute})) {
         Html::addCssClass($this->labelOptions, 'active');
     }
     parent::init();
 }
예제 #3
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!isset($this->options['ng-class'])) {
         $this->options['ng-class'] = Json::encode(['has-error' => new JsExpression(sprintf('error.%s', str_replace('[]', '', $this->attribute)))]);
     }
 }
예제 #4
0
 public function init()
 {
     parent::init();
     /*$this->owner->addRule($this->getAttributeName(), 'in', [
           'range' => $this->getOptions(),
           'allowArray' => true,
       ]);*/
 }
예제 #5
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $inputName = explode('_', $this->attribute);
     if (count($inputName) > 1) {
         $inputName[0] = $inputName[1];
     }
     $this->inputOptions = array_merge(['data-braintree-name' => \yii\helpers\Inflector::underscore($inputName[0]), 'autocomplete' => 'off'], $this->inputOptions);
 }
예제 #6
0
 public function init()
 {
     $this->horizontal = array_merge(['label' => 'col-sm-2', 'input' => 'col-sm-7', 'offset' => 'col-sm-offset-2 col-sm-10'], $this->horizontal);
     $this->inline = array_merge(['label' => 'sr-only', 'input' => 'col-sm-7', 'offset' => 'col-sm-offset-2 col-sm-10'], $this->inline);
     // Placeholder definition for inline forms
     if (!isset($this->inputOptions['placeholder']) && $this->form->type == ActiveForm::TYPE_INLINE) {
         $this->inputOptions['placeholder'] = Html::encode($this->model->getAttributeLabel($this->attribute));
     }
     parent::init();
 }
예제 #7
0
    public function init()
    {
        parent::init();
        // fix bag wrong render error if attribute is empty
        Yii::$app->getView()->registerJs(<<<JS
jQuery(".validate.invalid").on("focus", function() {
    \$(this).val(\$(this).val().trim());
});
JS
);
    }
예제 #8
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->namePrefix) {
         $this->inputOptions['name'] = $this->namePrefix;
         if (isset($this->tabularIndex)) {
             $this->inputOptions['name'] .= "[{$this->tabularIndex}]" . "[{$this->attribute}]";
         } else {
             $this->inputOptions['name'] .= $this->attribute;
         }
     }
     if (isset($this->tabularIndex)) {
         $this->attribute = "[{$this->tabularIndex}]" . $this->attribute;
     }
 }
예제 #9
0
 /**
  * Initializes the widget
  */
 public function init()
 {
     parent::init();
     if ($this->form->type === ActiveForm::TYPE_INLINE && !isset($this->autoPlaceholder)) {
         $this->autoPlaceholder = true;
     } elseif (!isset($this->autoPlaceholder)) {
         $this->autoPlaceholder = false;
     }
     if ($this->form->type === ActiveForm::TYPE_HORIZONTAL) {
         Html::addCssClass($this->labelOptions, 'control-label');
     }
     if (!empty($this->addClass)) {
         Html::addCssClass($this->inputOptions, $this->addClass);
     }
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->initActiveField();
 }
예제 #11
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $showLabels = $this->getConfigParam('showLabels');
     if ($this->form->type === ActiveForm::TYPE_INLINE && !isset($this->autoPlaceholder) && $showLabels !== true) {
         $this->autoPlaceholder = true;
     } elseif (!isset($this->autoPlaceholder)) {
         $this->autoPlaceholder = false;
     }
     if ($this->form->type === ActiveForm::TYPE_HORIZONTAL || $this->form->type === ActiveForm::TYPE_VERTICAL) {
         Html::addCssClass($this->labelOptions, 'control-label');
     }
     if ($showLabels === ActiveForm::SCREEN_READER) {
         Html::addCssClass($this->labelOptions, ActiveForm::SCREEN_READER);
     }
     $this->initLabels();
     $this->initLayout();
 }
예제 #12
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->options['tag'] = isset($this->options['tag']) ? $this->options['tag'] : 'section';
 }