/
v.bolshakov
/
AIEcosystem-Testing
Обзор
Документация
Войти
/
v.bolshakov
/
AIEcosystem-Testing
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
common/widgets/DateRangeWidget.php
56 строк
1 KB
Developer
Initial commit
03 авг 2026, 17:43
03 авг 2026, 17:43
7433917
Код
Авторство
О чём код?
<?php namespace common\widgets; use common\assets\DateRangeAsset; use yii\bootstrap\Html; use yii\helpers\ArrayHelper; use yii\widgets\InputWidget; /** * Виджет - ввод диапазона дат (интервал) * * @author Dmitry E. Semenov <sde.tomsk@gmail.com> * @copyright Self (c) 2020 */ class DateRangeWidget extends InputWidget { /** * @inheritdoc */ public function init() { parent::init(); if ($this->hasModel()) { $this->name = ArrayHelper::getValue($this->options, 'name', Html::getInputName($this->model, $this->attribute)); } } /** * @inheritdoc */ public function run() { echo $this->render('daterage.twig', [ 'data_id' => $this->options['id'], 'name' => $this->name, 'value' => $this->value, 'options' => $this->options, 'plugin' => ArrayHelper::getValue($this->options, 'plugin'), 'required' => ArrayHelper::getValue($this->options, 'required') ]); $this->registerPlugin(); } /** * @inheritdoc */ protected function registerPlugin() { $view = $this->getView(); DateRangeAsset::register($view); } }