Exemplo n.º 1
0
 protected function set_input_type($type, $name, $value)
 {
     if (isset($type) && isset($name) && isset($value)) {
         $input = NULL;
         $input_name = $name . '[value]';
         switch ($type) {
             case 'string':
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'integer':
                 $input = Html::input('number', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'text':
                 $input = Html::textarea($input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
             case 'boolean':
                 $input = Switchery::widget(['name' => $input_name, 'clientOptions' => ['color' => '#64bd63', 'secondaryColor' => '#dfdfdf', 'jackColor' => '#fff', 'jackSecondaryColor' => null, 'className' => 'switchery', 'disabled' => FALSE, 'disabledOpacity' => 0.5, 'speed' => '0.1s', 'size' => 'default'], 'options' => array_merge(['value' => '1'], $this->has_checked($value))]);
                 break;
             default:
                 $input = Html::input('text', $input_name, $value, ['class' => 'form-control', 'placeholder' => 'Значение пустое...']);
                 break;
         }
         return $input;
     }
     return FALSE;
 }