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