diff --git a/src/DatePicker.php b/src/DatePicker.php index b4100d6..65699ae 100644 --- a/src/DatePicker.php +++ b/src/DatePicker.php @@ -36,6 +36,8 @@ class DatePicker extends InputWidget */ public $inline = false; + public $link = false; + /** * @inheritdoc */ @@ -51,7 +53,7 @@ public function init() Html::addCssClass($this->options, 'input-' . $this->size); Html::addCssClass($this->containerOptions, 'input-group-' . $this->size); } - Html::addCssClass($this->options, 'form-control'); + if (!$this->link) Html::addCssClass($this->options, 'form-control'); Html::addCssClass($this->containerOptions, 'input-group date'); } @@ -64,6 +66,8 @@ public function run() $input = $this->hasModel() ? Html::activeTextInput($this->model, $this->attribute, $this->options) : Html::textInput($this->name, $this->value, $this->options); + + if ($this->link) $input = Html::a($this->value, '#', $this->options); if ($this->inline) { $input .= '
'; @@ -96,6 +100,7 @@ public function registerClientScript() } else { DatePickerAsset::register($view); } + // @codeCoverageIgnoreEnd $id = $this->options['id']; @@ -118,6 +123,7 @@ public function registerClientScript() $js[] = "$selector.on('$event', $handler);"; } } + $view->registerJs(implode("\n", $js)); }