Exemplo n.º 1
3
 /**
  * Initializes the widget
  */
 public function init()
 {
     parent::init();
     $this->_pluginName = $this->pluginConflict ? 'bootstrapSlider' : 'slider';
     if (!empty($this->value) || $this->value === 0) {
         if (is_array($this->value)) {
             throw new InvalidConfigException("Value cannot be passed as an array. If you wish to setup a range slider, pass the two values together as strings separated with a ',' sign.");
         }
         if (strpos($this->value, ',') > 0) {
             $values = explode(',', $this->value);
             static::validateValue($values[0]);
             static::validateValue($values[1]);
             $this->pluginOptions['value'] = [(double) $values[0], (double) $values[1]];
             $this->pluginOptions['range'] = true;
         } else {
             static::validateValue($this->value);
             $this->pluginOptions['value'] = (double) $this->value;
         }
     } else {
         // initialize value
         $this->pluginOptions['value'] = null;
     }
     Html::addCssClass($this->options, 'form-control');
     // initialize if disabled
     $this->_isDisabled = !empty($this->options['disabled']) && $this->options['disabled'] || !empty($this->options['readonly']) && $this->options['readonly'];
     if ($this->_isDisabled) {
         $this->pluginOptions['enabled'] = false;
     }
     $this->registerAssets();
     echo $this->getInput('textInput');
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     parent::run();
     $this->setPluginOptions();
     $this->registerAssets();
     echo $this->getInput('textInput');
 }
Exemplo n.º 3
0
 /**
  * Initializes the widget
  */
 public function init()
 {
     parent::init();
     $this->initItems();
     $this->sortableOptions['options']['id'] = $this->options['id'] . '-sortable';
     $this->registerAssets();
     $input = $this->hideInput ? 'hiddenInput' : 'textInput';
     echo Sortable::widget($this->sortableOptions) . PHP_EOL . $this->getInput($input);
 }
Exemplo n.º 4
0
 /**
  * @inherit doc
  * @throw InvalidConfigException
  */
 public function init()
 {
     parent::init();
     $this->registerAssets();
     if ($this->pluginLoading) {
         Html::addCssClass($this->options, 'rating-loading');
     }
     echo $this->getInput('textInput');
 }
Exemplo n.º 5
0
 public function init()
 {
     parent::init();
     $this->_msgCat = 'creditcard';
     $this->initI18N(__DIR__);
     $this->options['type'] = $this->type;
     $this->options['autocomplete'] = $this->autocomplete;
     $this->registerAssets();
 }
Exemplo n.º 6
0
 /**
  * Initializes the widget
  * @throws
  * @throws InvalidConfigException
  */
 public function init()
 {
     $this->pluginName = 'smsVerify';
     parent::init();
     $this->_container['id'] = $this->options['id'] . '-input';
     $this->pluginOptions['formId'] = $this->form->options['id'];
     $this->pluginOptions['mobileField'] = $this->mobileField;
     $this->registerAssets();
     echo $this->renderInput();
 }
Exemplo n.º 7
0
 /**
  * @inherit doc
  */
 public function init()
 {
     parent::init();
     $this->initPluginOptions();
     $this->_displayOptions = $this->options;
     $this->_displayOptions['id'] .= '-disp';
     if (isset($this->_displayOptions['name'])) {
         unset($this->_displayOptions['name']);
     }
     $this->registerAssets();
     $this->renderInput();
 }
Exemplo n.º 8
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->registerAssets();
     if ($this->pluginLoading) {
         Html::addCssClass($this->options, 'cbx-loading');
     }
     if ($this->initInputType !== self::INPUT_TEXT && $this->initInputType !== self::INPUT_CHECKBOX) {
         throw new InvalidConfigException('The "initInputType" property must be one of "' . self::INPUT_TEXT . '" or "' . self::INPUT_CHECKBOX . '"');
     }
     $this->initMarkup();
 }
Exemplo n.º 9
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $this->initLanguage();
     if ($this->hasModel()) {
         $this->name = ArrayHelper::remove($this->options, 'name', Html::getInputName($this->model, $this->attribute));
         $this->value = $this->model[$this->attribute];
     }
     echo $this->getInput('passwordInput');
     if (empty($this->pluginOptions['inputTemplate']) && ($this->size === 'lg' || $this->size === 'sm' || $this->togglePlacement === 'left')) {
         $this->pluginOptions['inputTemplate'] = $this->renderInputTemplate();
     }
     $this->registerAssets();
     parent::run();
 }
Exemplo n.º 10
0
 /**
  * Initializes the widget
  *
  * @throw InvalidConfigException
  */
 public function init()
 {
     parent::init();
     $this->_hidden = !empty($this->pluginOptions['data']) || !empty($this->pluginOptions['query']) || !empty($this->pluginOptions['ajax']) || isset($this->pluginOptions['tags']);
     if (!isset($this->data) && !$this->_hidden) {
         throw new InvalidConfigException("No 'data' source found for Select2. Either the 'data' property must be set OR one of 'data', 'query', 'ajax', or 'tags' must be set within 'pluginOptions'.");
     }
     if (!empty($this->options['placeholder']) && !$this->_hidden && (empty($this->options['multiple']) || $this->options['multiple'] == false)) {
         $this->data = ["" => ""] + $this->data;
     }
     Html::addCssClass($this->options, 'form-control');
     Html::addCssStyle($this->options, 'width:100%', false);
     $this->registerAssets();
     $this->renderInput();
 }
Exemplo n.º 11
0
 /**
  * @inherit doc
  * @throw InvalidConfigException
  */
 public function init()
 {
     if (empty($this->pluginOptions['url'])) {
         throw new InvalidConfigException("The 'pluginOptions[\"url\"]' property has not been set.");
     }
     if (empty($this->pluginOptions['depends']) || !is_array($this->pluginOptions['depends'])) {
         throw new InvalidConfigException("The 'pluginOptions[\"depends\"]' property must be set and must be an array of dependent dropdown element ID.");
     }
     if (empty($this->options['class'])) {
         $this->options['class'] = 'form-control';
     }
     if ($this->type === self::TYPE_SELECT2) {
         Config::checkDependency('select2\\Select2', 'yii2-widget-select2', 'for dependent dropdown for TYPE_SELECT2');
     }
     parent::init();
     if ($this->type !== self::TYPE_SELECT2 && !empty($this->options['placeholder'])) {
         $this->data = ['' => $this->options['placeholder']] + $this->data;
     }
     if ($this->type === self::TYPE_SELECT2 && (!empty($this->options['placeholder']) || !empty($this->select2Options['options']['placeholder']))) {
         $this->pluginOptions['placeholder'] = '';
     } elseif ($this->type === self::TYPE_SELECT2 && !empty($this->pluginOptions['placeholder']) && $this->pluginOptions['placeholder'] !== false) {
         $this->options['placeholder'] = $this->pluginOptions['placeholder'];
         $this->pluginOptions['placeholder'] = '';
     }
     $this->_view = $this->getView();
     $this->registerAssets();
     if ($this->type === self::TYPE_SELECT2) {
         if (empty($this->data)) {
             $this->data = ['' => ''];
         }
         if ($this->hasModel()) {
             $settings = ArrayHelper::merge($this->select2Options, ['model' => $this->model, 'attribute' => $this->attribute, 'data' => $this->data, 'options' => $this->options]);
         } else {
             $settings = ArrayHelper::merge($this->select2Options, ['name' => $this->name, 'value' => $this->value, 'data' => $this->data, 'options' => $this->options]);
         }
         echo Select2::widget($settings);
         $id = 'jQuery("#' . $this->options['id'] . '")';
         $text = ArrayHelper::getValue($this->pluginOptions, 'loadingText', 'Loading ...');
         $this->_view->registerJs("{$id}.on('depdrop.beforeChange',function(e,i,v){{$id}.select2('data',{text: '{$text}'});});");
         $this->_view->registerJs("{$id}.on('depdrop.change',function(e,i,v,c){{$id}.select2('val',{$id}.val());});");
     } else {
         echo $this->getInput(!empty($this->typename) ? $this->typename : 'dropdownList', true);
     }
 }
Exemplo n.º 12
0
 /**
  * @var array initialize the FileInput widget
  */
 public function init()
 {
     parent::init();
     $this->_msgCat = 'fileinput';
     $this->initI18N(__DIR__);
     $this->registerAssets();
     if ($this->pluginLoading) {
         Html::addCssClass($this->options, 'file-loading');
     }
     $input = $this->getInput('fileInput');
     $script = 'document.getElementById("' . $this->options['id'] . '").className.replace(/\\bfile-loading\\b/,"");';
     if ($this->showMessage) {
         $validation = ArrayHelper::getValue($this->pluginOptions, 'showPreview', true) ? 'file preview and multiple file upload' : 'multiple file upload';
         $message = '<strong>' . Yii::t('fileinput', 'Note:') . '</strong> ' . Yii::t('fileinput', 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.', ['validation' => $validation]);
         $content = Html::tag('div', $message, $this->messageOptions) . "<script>{$script};</script>";
         $input .= "\n" . $this->validateIE($content);
     }
     echo $input;
 }
Exemplo n.º 13
0
 /**
  * @inherit doc
  * @throw InvalidConfigException
  */
 public function init()
 {
     if (empty($this->pluginOptions['url'])) {
         throw new InvalidConfigException("The 'pluginOptions[\"url\"]' property has not been set.");
     }
     if (empty($this->pluginOptions['depends']) || !is_array($this->pluginOptions['depends'])) {
         throw new InvalidConfigException("The 'pluginOptions[\"depends\"]' property must be set and must be an array of dependent dropdown element ID.");
     }
     if (empty($this->options['class'])) {
         $this->options['class'] = 'form-control';
     }
     if ($this->type === self::TYPE_SELECT2) {
         Config::checkDependency('select2\\Select2', 'yii2-widget-select2', 'for dependent dropdown for TYPE_SELECT2');
     }
     parent::init();
     if ($this->type !== self::TYPE_SELECT2 && !empty($this->options['placeholder'])) {
         $this->data = ['' => $this->options['placeholder']] + $this->data;
     }
     $this->registerAssets();
 }
Exemplo n.º 14
0
 /**
  * @var array initialize the FileInput widget
  */
 public function init()
 {
     parent::init();
     Yii::setAlias('@fileinput', dirname(__FILE__));
     if (empty($this->i18n)) {
         $this->i18n = ['class' => 'yii\\i18n\\PhpMessageSource', 'basePath' => '@fileinput/messages'];
     }
     Yii::$app->i18n->translations['fileinput'] = $this->i18n;
     $this->registerAssets();
     if ($this->pluginLoading) {
         Html::addCssClass($this->options, 'file-loading');
     }
     $input = $this->getInput('fileInput');
     $id = 'jQuery("#' . $this->options['id'] . '")';
     if ($this->showMessage) {
         $validation = ArrayHelper::getValue($this->pluginOptions, 'showPreview', true) ? 'file preview and multiple file upload' : 'multiple file upload';
         $message = '<strong>' . Yii::t('fileinput', 'Note:') . '</strong> ' . Yii::t('fileinput', 'Your browser does not support {validation}. Try an alternative or more recent browser to access these features.', ['validation' => $validation]);
         $content = Html::tag('div', $message, $this->messageOptions) . "<script>{$id}.removeClass('file-loading');</script>";
         $input .= "\n" . $this->validateIE($content);
     }
     echo $input;
 }
Exemplo n.º 15
0
 /**
  * Initializes the widget
  *
  * @throws \yii\base\InvalidConfigException
  */
 public function init()
 {
     if (!in_array($this->type, self::$_allowedTypes)) {
         $types = implode("', '", self::$_allowedTypes);
         throw new InvalidConfigException("Invalid 'type' entered. Must be one of: '{$types}'.");
     }
     parent::init();
     if (empty($this->options['class'])) {
         $this->options['class'] = 'form-control';
     }
     $this->initPluginOptions();
     if ($this->label !== false) {
         echo $this->getLabel();
     }
     if ($this->type == self::TYPE_HTML5) {
         $type = ArrayHelper::remove($this->options, 'type', 'text');
         $input = $this->hasModel() ? Html::activeInput($type, $this->model, $this->attribute, $this->options) : Html::input($type, $this->name, $this->value, $this->options);
     } else {
         $input = $this->getInput($this->type);
     }
     echo $input;
     $this->registerAssets();
 }
Exemplo n.º 16
0
 /**
  * Initializes the widget
  *
  * @throws InvalidConfigException
  */
 public function init()
 {
     $this->_msgCat = 'kveditable';
     parent::init();
     if (empty($this->inputType)) {
         throw new InvalidConfigException("The 'type' of editable input must be set.");
     }
     if (!Config::isValidInput($this->inputType)) {
         throw new InvalidConfigException("Invalid input type '{$this->inputType}'.");
     }
     if ($this->inputType === self::INPUT_WIDGET && empty($this->widgetClass)) {
         throw new InvalidConfigException("The 'widgetClass' must be set when the 'inputType' is set to 'widget'.");
     }
     if (Config::isDropdownInput($this->inputType) && !isset($this->data)) {
         throw new InvalidConfigException("You must set the 'data' property for '{$this->inputType}'.");
     }
     if (!empty($this->formClass) && !class_exists($this->formClass)) {
         throw new InvalidConfigException("The form class '{$this->formClass}' does not exist.");
     }
     Config::validateInputWidget($this->inputType);
     $this->initI18N(__DIR__);
     $this->initOptions();
     $this->_popoverOptions['options']['id'] = $this->options['id'] . '-popover';
     $this->_popoverOptions['toggleButton']['id'] = $this->options['id'] . '-targ';
     $this->registerAssets();
     echo Html::beginTag('div', $this->containerOptions);
     if ($this->format == self::FORMAT_BUTTON) {
         echo Html::tag('div', $this->displayValue, $this->editableValueOptions);
     }
     if ($this->asPopover === true) {
         PopoverX::begin($this->_popoverOptions);
     } elseif ($this->format !== self::FORMAT_BUTTON) {
         echo $this->renderToggleButton();
     }
     echo Html::beginTag('div', $this->contentOptions);
     $class = $this->formClass;
     $this->_form = $class::begin($this->formOptions);
     if (!$this->_form instanceof \yii\widgets\ActiveForm) {
         throw new InvalidConfigException("The form class '{$class}' MUST extend from \\yii\\widgets\\ActiveForm.");
     }
 }
Exemplo n.º 17
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->pluginOptions['theme'] = $this->theme;
     parent::init();
     if (ArrayHelper::getValue($this->pluginOptions, 'tags', false)) {
         $this->options['multiple'] = true;
     }
     if ($this->hideSearch) {
         $css = ArrayHelper::getValue($this->pluginOptions, 'dropdownCssClass', '');
         $css .= ' kv-hide-search';
         $this->pluginOptions['dropdownCssClass'] = $css;
     }
     $this->initPlaceholder();
     if (!isset($this->data)) {
         $key = empty($this->value) ? '' : $this->value;
         $val = empty($this->initValueText) ? $key : $this->initValueText;
         $this->data = [$key => $val];
     }
     Html::addCssClass($this->options, 'form-control');
     Html::addCssStyle($this->options, 'width:100%', false);
     $this->initLanguage();
     $this->registerAssets();
     $this->renderInput();
 }
Exemplo n.º 18
0
 /**
  * Initializes the widget
  * @throws
  * @throws InvalidConfigException
  */
 public function init()
 {
     $this->_msgCat = 'kvicon';
     $this->pluginName = 'kvIconInput';
     parent::init();
     $this->_hasAddon = $this->type == self::TYPE_COMPONENT_PREPEND || $this->type == self::TYPE_COMPONENT_APPEND;
     if ($this->type < 1 || $this->type > 4 || !is_int($this->type)) {
         throw new InvalidConfigException("Invalid value for the property 'type'. Must be an integer between 1 and 6.");
     }
     if (isset($this->form) && !$this->form instanceof \yii\widgets\ActiveForm) {
         throw new InvalidConfigException("The 'form' property must be of type \\yii\\widgets\\ActiveForm");
     }
     if (isset($this->form) && !$this->hasModel()) {
         throw new InvalidConfigException("You must set the 'model' and 'attribute' properties when the 'form' property is set.");
     }
     if (isset($this->addon) && !is_array($this->addon)) {
         throw new InvalidConfigException("The 'addon' property must be setup as an array with 'part1', 'part2', 'part3', and/or 'part4' keys.");
     }
     $this->options['id'] .= time();
     $this->_container['id'] = $this->options['id'] . '-' . $this->_msgCat;
     $this->registerAssets();
     echo $this->renderInput();
 }
Exemplo n.º 19
0
 /**
  * Initializes the widget
  *
  * @throw InvalidConfigException
  */
 public function init()
 {
     $this->_msgCat = 'kvdatetime';
     parent::init();
     if ($this->type < 1 || $this->type > 5 || !is_int($this->type)) {
         throw new InvalidConfigException("Invalid value for the property 'type'. Must be an integer between 1 and 5.");
     }
     $this->initI18N();
     $s = DIRECTORY_SEPARATOR;
     $this->setLanguage('bootstrap-datetimepicker.', __DIR__ . "{$s}assets{$s}");
     $this->parseDateFormat('datetime');
     $this->_id = $this->type == self::TYPE_INPUT ? 'jQuery("#' . $this->options['id'] . '")' : 'jQuery("#' . $this->options['id'] . '").parent()';
     $this->registerAssets();
     echo $this->renderInput();
 }
Exemplo n.º 20
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->initEditable();
 }
Exemplo n.º 21
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     parent::run();
     $this->renderWidget();
 }
Exemplo n.º 22
0
 /**
  * Initializes the widget
  *
  * @throw InvalidConfigException
  */
 public function init()
 {
     parent::init();
     $this->_msgCat = 'kvdrp';
     $this->initI18N(__DIR__);
     $this->initLocale();
     if ($this->convertFormat && isset($this->pluginOptions['format'])) {
         $this->pluginOptions['format'] = static::convertDateFormat($this->pluginOptions['format']);
     }
     $this->_format = ArrayHelper::getValue($this->pluginOptions, 'format', 'YYYY-MM-DD');
     $this->_separator = ArrayHelper::getValue($this->pluginOptions, 'separator', ' - ');
     if (!empty($this->value)) {
         $dates = explode($this->_separator, $this->value);
         if (count($dates) > 1) {
             $this->pluginOptions['startDate'] = $dates[0];
             $this->pluginOptions['endDate'] = $dates[1];
         }
     }
     $value = empty($this->value) ? '' : $this->value;
     $this->containerTemplate = str_replace('{value}', $value, $this->containerTemplate);
     $this->initRange();
     $this->containerOptions['id'] = $this->options['id'] . '-container';
     $this->registerAssets();
     echo $this->renderInput();
 }
Exemplo n.º 23
0
 /**
  * Initializes the widget
  *
  * @throw InvalidConfigException
  */
 public function init()
 {
     $this->_msgCat = 'kvdtime';
     parent::init();
     if ($this->type < 1 || $this->type > 5 || !is_int($this->type)) {
         throw new InvalidConfigException("Invalid value for the property 'type'. Must be an integer between 1 and 5.");
     }
     $dir = Yii::getAlias('@vendor/kartik-v/yii2-widget-datetimepicker');
     $this->initI18N($dir);
     $s = DIRECTORY_SEPARATOR;
     $this->setLanguage('bootstrap-datetimepicker.', "{$dir}{$s}assets{$s}");
     $this->parseDateFormat('datetime');
     if (empty($this->_container['id'])) {
         $this->_container['id'] = $this->options['id'] . '-datetime';
     }
     if (empty($this->layout)) {
         if ($this->type == self::TYPE_COMPONENT_PREPEND) {
             $this->layout = '{picker}{remove}{input}';
         }
         if ($this->type == self::TYPE_COMPONENT_APPEND) {
             $this->layout = '{input}{remove}{picker}';
         }
     }
     $this->registerAssets();
     echo $this->renderInput();
 }
Exemplo n.º 24
0
 /**
  * Initializes the widget
  *
  * @throw InvalidConfigException
  */
 public function init()
 {
     $this->_msgCat = 'kvdate';
     parent::init();
     $this->_hasAddon = $this->type == self::TYPE_COMPONENT_PREPEND || $this->type == self::TYPE_COMPONENT_APPEND;
     if ($this->type === self::TYPE_RANGE && $this->attribute2 === null && $this->name2 === null) {
         throw new InvalidConfigException("Either 'name2' or 'attribute2' properties must be specified for a datepicker 'range' markup.");
     }
     if ($this->type === self::TYPE_RANGE && !class_exists('\\kartik\\field\\FieldRangeAsset')) {
         throw new InvalidConfigException("The yii2-field-range extension is not installed and is a pre-requisite for a DatePicker RANGE type. To install this extension run this command on your console: \n\nphp composer.phar require kartik-v/yii2-field-range \"*\"");
     }
     if ($this->type < 1 || $this->type > 6 || !is_int($this->type)) {
         throw new InvalidConfigException("Invalid value for the property 'type'. Must be an integer between 1 and 6.");
     }
     if (isset($this->form) && !$this->form instanceof \yii\widgets\ActiveForm) {
         throw new InvalidConfigException("The 'form' property must be of type \\yii\\widgets\\ActiveForm");
     }
     if (isset($this->form) && !$this->hasModel()) {
         throw new InvalidConfigException("You must set the 'model' and 'attribute' properties when the 'form' property is set.");
     }
     if (isset($this->form) && $this->type === self::TYPE_RANGE && !isset($this->attribute2)) {
         throw new InvalidConfigException("The 'attribute2' property must be set for a 'range' type markup and a defined 'form' property.");
     }
     $s = DIRECTORY_SEPARATOR;
     $this->initI18N(__DIR__);
     $this->setLanguage('bootstrap-datepicker.', __DIR__ . "{$s}assets{$s}", null, '.min.js');
     $this->parseDateFormat('date');
     $this->_id = $this->type == self::TYPE_INPUT ? 'jQuery("#' . $this->options['id'] . '")' : 'jQuery("#' . $this->options['id'] . '").parent()';
     $this->registerAssets();
     echo $this->renderInput();
 }
Exemplo n.º 25
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->pluginOptions['theme'] = $this->theme;
     if (!empty($this->addon) || empty($this->pluginOptions['width'])) {
         $this->pluginOptions['width'] = '100%';
     }
     $multiple = ArrayHelper::getValue($this->pluginOptions, 'multiple', false);
     unset($this->pluginOptions['multiple']);
     $multiple = ArrayHelper::getValue($this->options, 'multiple', $multiple);
     $this->options['multiple'] = $multiple;
     if ($this->hideSearch) {
         $this->pluginOptions['minimumResultsForSearch'] = new JsExpression('Infinity');
     }
     $this->initPlaceholder();
     if (!isset($this->data)) {
         if (!isset($this->value) && !isset($this->initValueText)) {
             $this->data = [];
         } else {
             $key = isset($this->value) ? $this->value : ($multiple ? [] : '');
             $val = isset($this->initValueText) ? $this->initValueText : $key;
             $this->data = $multiple ? array_combine($key, $val) : [$key => $val];
         }
     }
     Html::addCssClass($this->options, 'form-control');
     $this->initLanguage('language', true);
     $this->registerAssets();
     $this->renderInput();
 }
Exemplo n.º 26
0
 /**
  * Initializes the widget
  *
  * @throw InvalidConfigException
  */
 public function init()
 {
     $this->_msgCat = 'kvdate';
     $this->pluginName = 'kvDatepicker';
     parent::init();
     $this->validateConfig();
     $this->_hasAddon = $this->type == self::TYPE_COMPONENT_PREPEND || $this->type == self::TYPE_COMPONENT_APPEND;
     $s = DIRECTORY_SEPARATOR;
     $this->initI18N(__DIR__);
     $this->setLanguage('bootstrap-datepicker.', __DIR__ . "{$s}assets{$s}", null, '.min.js');
     $this->parseDateFormat('date');
     $this->_container['id'] = $this->options['id'] . '-' . $this->_msgCat;
     if ($this->type == self::TYPE_INLINE) {
         $this->_container['data-date'] = $this->value;
     }
     if (empty($this->layout)) {
         if ($this->type == self::TYPE_COMPONENT_PREPEND) {
             $this->layout = '{picker}{remove}{input}';
         } elseif ($this->type == self::TYPE_COMPONENT_APPEND) {
             $this->layout = '{input}{remove}{picker}';
         } elseif ($this->type == self::TYPE_RANGE) {
             $this->layout = '{input1}{separator}{input2}';
         }
     }
     $this->options['data-datepicker-source'] = $this->type == self::TYPE_INPUT ? $this->options['id'] : $this->_container['id'];
     $this->options['data-datepicker-type'] = $this->type;
     $this->registerAssets();
     echo $this->renderInput();
 }
Exemplo n.º 27
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     parent::run();
     $this->renderDatePicker();
 }
Exemplo n.º 28
0
 /**
  * Runs widget
  *
  * @return string|void
  */
 public function run()
 {
     $this->registerAssets();
     echo $this->getDisplayInput() . $this->getSaveInput();
     parent::run();
 }
Exemplo n.º 29
0
 /**
  * Runs the widget
  */
 public function init()
 {
     parent::init();
     $this->initInput();
 }
Exemplo n.º 30
-1
 public function init()
 {
     \kartik\base\InputWidget::init();
     $this->pluginOptions['theme'] = $this->theme;
     if (!empty($this->addon) || empty($this->pluginOptions['width'])) {
         $this->pluginOptions['width'] = '100%';
     }
     $multiple = ArrayHelper::getValue($this->pluginOptions, 'multiple', false);
     unset($this->pluginOptions['multiple']);
     $multiple = ArrayHelper::getValue($this->options, 'multiple', $multiple);
     $this->options['multiple'] = $multiple;
     if ($this->hideSearch) {
         $css = ArrayHelper::getValue($this->pluginOptions, 'dropdownCssClass', '');
         $css .= ' kv-hide-search';
         $this->pluginOptions['dropdownCssClass'] = $css;
     }
     $this->initPlaceholder();
     if ($this->data == null) {
         if (!isset($this->value) && !isset($this->initValueText)) {
             $this->data = [];
         } else {
             $key = isset($this->value) ? $this->value : ($multiple ? [] : '');
             $val = isset($this->initValueText) ? $this->initValueText : $key;
             $this->data = $multiple ? array_combine($key, $val) : [$key => $val];
         }
     }
     Html::addCssClass($this->options, 'form-control');
     $this->initLanguage('language', true);
     $this->registerAssets();
     $this->renderInput();
 }