models/DiyWidget.php
private static function getInputByType($type = 'text', $templateSetting = null, $keySetting = null, $value = null, $items = []){
        switch ($type) {
            case 'textarea':
                $templateSetting = Html::textarea($keySetting, $value, ['class' => 'form-control', 'title' => $keySetting]);
                break;
            case 'date':
                $templateSetting = DateControl::widget([
                    'name' => $keySetting,
                    'value' => $value,
                    'type'=>DateControl::FORMAT_DATE,
                    'ajaxConversion'=>false,
                    'options' => [
                        'pluginOptions' => [
                            'autoclose' => true
                        ],
                        'options' => ['title' => $keySetting],
                    ],
                    'displayFormat' => 'dd-MM-yyyy',
                    'saveFormat' => 'yyyy-MM-dd',
                ]);
                break;
            case 'datetime':
                $templateSetting = DateControl::widget([
                    'name' => $keySetting,
                    'value' => $value,
                    'type'=>DateControl::FORMAT_DATETIME,
                    'ajaxConversion'=>false,
                    'options' => [
                        'pluginOptions' => [
                            'autoclose' => true
                        ],
                        'options' => ['title' => $keySetting],
                    ],
                    'saveFormat' => 'yyyy-MM-dd',
                ]);
                break;
            case 'daterange':
                $templateSetting = DateRangePicker::widget([
                    'name' => $keySetting,
                    'value' => $value,
                    'presetDropdown'=>true,
                    'hideInput'=>true,
                    'options' => ['title' => $keySetting],
                ]);
                break;
            case 'dropdown':
                $templateSetting = Html::dropDownList($keySetting, $value, $items, ['class' => 'form-control', 'title' => $keySetting]);
                break;
            case 'checkbox':
                $templateSetting = Html::checkboxList($keySetting, $value, $items, ['class' => 'form-control', 'title' => $keySetting]);
                break;
            case 'radio':
                $templateSetting = Html::radioList($keySetting, $value, $items, ['class' => 'form-control', 'title' => $keySetting]);
                break;
            default:
                $templateSetting = Html::textInput($keySetting, $value, ['class' => 'form-control', 'title' => $keySetting]);
                break;
        }
        
        return $templateSetting;
    }
private static function getInputByType($type = 'text', $templateSetting = null, $keySetting = null, $value = null, $items = []){
        switch ($type) {
            case 'textarea':
                $templateSetting = Html::textarea($keySetting, $value, ['class' => 'form-control', 'title' => $keySetting]);
                break;
            case 'date':
                $templateSetting = DateControl::widget([
                    'name' => $keySetting,
                    'value' => $value,
                    'type'=>DateControl::FORMAT_DATE,
                    'ajaxConversion'=>false,
                    'options' => [
                        'pluginOptions' => [
                            'autoclose' => true
                        ],
                        'options' => ['title' => $keySetting],
                    ],
                    'displayFormat' => 'dd-MM-yyyy',
                    'saveFormat' => 'yyyy-MM-dd',
                ]);
                break;
            case 'datetime':
                $templateSetting = DateControl::widget([
                    'name' => $keySetting,
                    'value' => $value,
                    'type'=>DateControl::FORMAT_DATETIME,
                    'ajaxConversion'=>false,
                    'options' => [
                        'pluginOptions' => [
                            'autoclose' => true
                        ],
                        'options' => ['title' => $keySetting],
                    ],
                    'saveFormat' => 'yyyy-MM-dd',
                ]);
                break;
            case 'daterange':
                $templateSetting = DateRangePicker::widget([
                    'name' => $keySetting,
                    'value' => $value,
                    'presetDropdown'=>true,
                    'hideInput'=>true,
                    'options' => ['title' => $keySetting],
                ]);
                break;
            case 'dropdown':
                $templateSetting = Html::dropDownList($keySetting, $value, $items, ['class' => 'form-control', 'title' => $keySetting]);
                break;
            case 'checkbox':
                $templateSetting = Html::checkboxList($keySetting, $value, $items, ['class' => 'form-control', 'title' => $keySetting]);
                break;
            case 'radio':
                $templateSetting = Html::radioList($keySetting, $value, $items, ['class' => 'form-control', 'title' => $keySetting]);
                break;
            default:
                $templateSetting = Html::textInput($keySetting, $value, ['class' => 'form-control', 'title' => $keySetting]);
                break;
        }
        
        return $templateSetting;
    }
private static function getInputByType ( $ type = 'text' , $ templateSetting = null , $ keySetting = null , $ value = null , $ items = [ ] ) { switch ( $ type ) { case 'textarea' : $ templateSetting = Html :: textarea ( $ keySetting , $ value , [ 'class' => 'form-control' , 'title' => $ keySetting ] ) ; break ; case 'date' : $ templateSetting = DateControl :: widget ( [ 'name' => $ keySetting , 'value' => $ value , 'type' => DateControl :: FORMAT_DATE , 'ajaxConversion' => false , 'options' => [ 'pluginOptions' => [ 'autoclose' => true ] , 'options' => [ 'title' => $ keySetting ] , ] , 'displayFormat' => 'dd-MM-yyyy' , 'saveFormat' => 'yyyy-MM-dd' , ] ) ; break ; case 'datetime' : $ templateSetting = DateControl :: widget ( [ 'name' => $ keySetting , 'value' => $ value , 'type' => DateControl :: FORMAT_DATETIME , 'ajaxConversion' => false , 'options' => [ 'pluginOptions' => [ 'autoclose' => true ] , 'options' => [ 'title' => $ keySetting ] , ] , 'saveFormat' => 'yyyy-MM-dd' , ] ) ; break ; case 'daterange' : $ templateSetting = DateRangePicker :: widget ( [ 'name' => $ keySetting , 'value' => $ value , 'presetDropdown' => true , 'hideInput' => true , 'options' => [ 'title' => $ keySetting ] , ] ) ; break ; case 'dropdown' : $ templateSetting = Html :: dropDownList ( $ keySetting , $ value , $ items , [ 'class' => 'form-control' , 'title' => $ keySetting ] ) ; break ; case 'checkbox' : $ templateSetting = Html :: checkboxList ( $ keySetting , $ value , $ items , [ 'class' => 'form-control' , 'title' => $ keySetting ] ) ; break ; case 'radio' : $ templateSetting = Html :: radioList ( $ keySetting , $ value , $ items , [ 'class' => 'form-control' , 'title' => $ keySetting ] ) ; break ; default : $ templateSetting = Html :: textInput ( $ keySetting , $ value , [ 'class' => 'form-control' , 'title' => $ keySetting ] ) ; break ; } return $ templateSetting ; }
Ham get html cho input theo type
@param string $type input co the la text, textarea, editor, date, datetime, daterange, dropdown, checkbox, radio
@param string $templateSetting giao dien input theo type
@param string $keySetting ten cua key setting
@param string $value gia tri cua key setting
@param array $items Mang cac gia tri cua setting neu setting co type la dropdown, checkbox, radio
@return string
Ham get html cho input theo type